File size: 929 Bytes
0c04d4b 584a4b2 | 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 | import gradio as gr
import requests
import pandas as pd
import ast
def image_classifier(grand_topics,topics, sub_topics, difficulty, count):
url = "https://d5cdtgvt04.execute-api.ap-south-1.amazonaws.com/test/q_gen"
params = {
"grand_topic_ids": "16595,898,746",
"topic_ids": "59559,59564,59565,59563",
"sub_topic_ids": "54345,31152,4011",
"count":"10",
"difficulty":"8"
}
try:
response = requests.get(url, params=params)
response.raise_for_status() # Raise an exception if the request was not successful
# Access the response content
content = response.text
except requests.exceptions.RequestException as e:
print("Error occurred:", e)
return pd.DataFrame(ast.literal_eval(content))
demo = gr.Interface(fn=image_classifier, inputs=["text", "text","text", ], outputs="dataframe")
demo.launch(share=True) |