Download app.py from krushna/q_gen: direct link, hf CLI and curl.
- Browser
- Download file 929 Bytes
-
https://huggingface.co/krushna/q_gen/resolve/main/app.py
- Command line
-
hf download hf://krushna/q_gen/app.py
-
curl -L -o app.py https://huggingface.co/krushna/q_gen/resolve/main/app.py
929 Bytes
| 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) |