-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
37 lines (26 loc) · 1.08 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import time
import gradio as gr
import requests
# The API endpoint
url = "https://jsonplaceholder.typicode.com/posts"
# Data to be sent
data = {
"userID": 1,
"title": "Making a POST request",
"body": "This is the data we created."
}
#Function to show the GCS File as HyperLink
def gcs_download(uri):
return f"[Link to CSV File]({uri})"
# Call to external System
def call_data_wizard(text):
response = requests.post(url, json=data)
print(response)
return gcs_download('https://storage.cloud.google.com/<bucket>/<file_name>.csv')
def slow_echo(message, history):
time.sleep(0.3)
yield call_data_wizard(message)
demo = gr.ChatInterface(slow_echo, type="messages", title="Data Wizard", chatbot=gr.Chatbot(height=350), textbox=gr.Textbox(placeholder="Provide me an instruction",
container=False, scale=7), submit_btn=True, show_progress="full", examples=["Get me list of top 20 Orders"])
if __name__ == "__main__":
demo.launch()