Authenticate google
Browse files- app.py +2 -1
- examples/authenticate_google.py +55 -0
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
import actions as a
|
4 |
-
from examples import best_clubs, generate_ad, summarize_website
|
5 |
from components import all_tasks, Tasks
|
6 |
|
7 |
|
@@ -65,5 +65,6 @@ with gr.Blocks() as demo:
|
|
65 |
summarize_website.render()
|
66 |
generate_ad.render()
|
67 |
best_clubs.render()
|
|
|
68 |
|
69 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
import actions as a
|
4 |
+
from examples import authenticate_google, best_clubs, generate_ad, summarize_website
|
5 |
from components import all_tasks, Tasks
|
6 |
|
7 |
|
|
|
65 |
summarize_website.render()
|
66 |
generate_ad.render()
|
67 |
best_clubs.render()
|
68 |
+
authenticate_google.render()
|
69 |
|
70 |
demo.launch()
|
examples/authenticate_google.py
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from components import AITask, CodeTask
|
3 |
+
|
4 |
+
from examples import demo_buttons, demo_tasks
|
5 |
+
|
6 |
+
|
7 |
+
DEMO_ID = __name__
|
8 |
+
tasks = [
|
9 |
+
CodeTask(
|
10 |
+
0,
|
11 |
+
"{your json key in here} See: https://developers.google.com/calendar/api/quickstart/python#authorize_credentials_for_a_desktop_application",
|
12 |
+
visible=True,
|
13 |
+
code_value="Authenticate to read my google calendar. Return credentials as a json. I will provide the client secrets config in a json (not a file).",
|
14 |
+
),
|
15 |
+
CodeTask(
|
16 |
+
1,
|
17 |
+
"{t0}",
|
18 |
+
visible=True,
|
19 |
+
code_value="Given a credentials json, get my calendar events of tomorrow.",
|
20 |
+
),
|
21 |
+
AITask(
|
22 |
+
2,
|
23 |
+
"""Here are the events in my calendar for tomorrow:
|
24 |
+
{t1}
|
25 |
+
|
26 |
+
Which hours of my day are free?""",
|
27 |
+
visible=True,
|
28 |
+
),
|
29 |
+
]
|
30 |
+
demo_tasks[DEMO_ID] = tasks
|
31 |
+
|
32 |
+
|
33 |
+
def render():
|
34 |
+
with gr.Tab("Example: Authenticate to google"):
|
35 |
+
with gr.Box():
|
36 |
+
demo_id = gr.Textbox(DEMO_ID, visible=False)
|
37 |
+
gr.Dropdown(
|
38 |
+
value=CodeTask.name,
|
39 |
+
label="Pick a new Task",
|
40 |
+
interactive=False,
|
41 |
+
)
|
42 |
+
tasks[0].render()
|
43 |
+
gr.Dropdown(
|
44 |
+
value=CodeTask.name,
|
45 |
+
label="Pick a new Task",
|
46 |
+
interactive=False,
|
47 |
+
)
|
48 |
+
tasks[1].render()
|
49 |
+
gr.Dropdown(
|
50 |
+
value=CodeTask.name,
|
51 |
+
label="Pick a new Task",
|
52 |
+
interactive=False,
|
53 |
+
)
|
54 |
+
tasks[2].render()
|
55 |
+
demo_buttons(demo_id, tasks)
|