Download app.py from SIUT/aitutor: direct link, hf CLI and curl.
- Browser
- Download file 509 Bytes
-
https://huggingface.co/spaces/SIUT/aitutor/resolve/main/app.py
- Command line
-
hf download hf://spaces/SIUT/aitutor/app.py
-
curl -L -o app.py https://huggingface.co/spaces/SIUT/aitutor/resolve/main/app.py
509 Bytes
| import gradio as gr | |
| from huggingface_hub import InferenceClient | |
| client = InferenceClient("HuggingFaceH4/zephyr-7b-beta") | |
| def ai_tutor(message, history): | |
| response = client.chat_completion( | |
| messages=[{"role": "user", "content": message}], | |
| max_tokens=200 | |
| ) | |
| return response.choices[0].message.content | |
| demo = gr.ChatInterface( | |
| fn=ai_tutor, | |
| title="SIUT AITutor", | |
| description="An AI-powered tutor helping students learn AI, cybersecurity, and programming." | |
| ) | |
| demo.launch() |