Download app.py from pmirkovic/Test2: direct link, hf CLI and curl.
- Browser
- Download file 451 Bytes
-
https://huggingface.co/spaces/pmirkovic/Test2/resolve/main/app.py
- Command line
-
hf download hf://spaces/pmirkovic/Test2/app.py
-
curl -L -o app.py https://huggingface.co/spaces/pmirkovic/Test2/resolve/main/app.py
451 Bytes
| import gradio as gr | |
| import requests | |
| def chat(input_text): | |
| url = "https://api-inference.huggingface.co/models/t5-small" | |
| payload = {"inputs": input_text} | |
| response = requests.post(url, json=payload) | |
| try: | |
| return response.json()[0]['generated_text'] | |
| except Exception: | |
| return str(response.json()) | |
| gr.Interface( | |
| fn=chat, | |
| inputs="text", | |
| outputs="text", | |
| title="Simple Chatbot (No Token Needed)" | |
| ).launch() | |