vid2densepose icon indicating copy to clipboard operation
vid2densepose copied to clipboard

Support Google Colab

Open shinshin86 opened this issue 1 year ago • 2 comments

Hi!

I've tried to launch the Gradio app from Google Colab and allow users to control it from the web UI. Could you accept this modification?

Thank you!

shinshin86 avatar Dec 06 '23 00:12 shinshin86

Sorry, this was a fix for another branch, but I mistakenly pushed it to this branch. I've reverted and undone it, so don't worry about it. https://github.com/Flode-Labs/vid2densepose/pull/6/commits/3c545fc0db4bf1c782d94c4dddd57635bb10b5f9 https://github.com/Flode-Labs/vid2densepose/pull/6/commits/d1f832be401911368d732998da729b244ec2b418

shinshin86 avatar Dec 08 '23 22:12 shinshin86

Hey I see you look very experienced in Google colab

I found an error using Google colab for some of my small projects I didn't find any solution in any community like stack overflow,and other community

So I get you

The code is

import os import google_auth_oauthlib.flow import googleapiclient.discovery

scopes = ["https://www.googleapis.com/auth/youtube.readonly"]

def main(): os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"

api_service_name = "youtube"
api_version = "v3"
client_secrets_file = "/content/credentials.json"

# Get credentials and create an API client
flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(
    client_secrets_file, scopes,redirect_uri="http://localhost:8800/")

authorization_url, _ = flow.authorization_url()

print(f"Please go to this URL to authorize: {authorization_url}")
authorization_response = input("Paste the authorization code here: ")

flow.fetch_token(
    "https://accounts.google.com/o/oauth2/token",
    authorization_response=authorization_response
)

youtube = googleapiclient.discovery.build(
    api_service_name, api_version, credentials=flow.credentials)

request = youtube.channels().list(
    part="snippet,contentDetails,statistics",
    mine=True
)
response = request.execute()

print(response)

if name == "main": main()

When opening the link and selecting my account after that it showing me

This site can’t be reached localhost refused to connect. Try:

Checking the connection ERR_CONNECTION_REFUSED

(I dont want to use vs code( it works there ))

Woomer avatar Dec 16 '23 04:12 Woomer