Spaces:
Runtime error
Runtime error
File size: 758 Bytes
26de46f b52aa79 26de46f b52aa79 26de46f |
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 |
import gradio as gr
import requests
import json
import pandas as pd
url = 'http://3.144.36.142/athena_interaction'
myobj = {}
myobj["sql_query"] = """
select * from users
"""
myobj["athena_database_name"] = "apex-sta01"
x = requests.post(url, json = myobj)
data = {}
w = {}
dc = "data="+x.text
exec(dc)
for i in set(data.keys()):
w[i] = []
for k,v in data[i].items():
w[i].append(v)
df = pd.DataFrame(w)
def greet(name):
return df.to_html()
with gr.Blocks() as iface:
name = gr.Textbox(label="Name")
output = gr.Textbox(label="Output Box")
greet_btn = gr.Button("Greet")
greet_btn.click(fn=greet, inputs=name, outputs=output, api_name="greet")
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch() |