Spaces:
Runtime error
Runtime error
Download app.py from king-eagle/chatbot-demo: direct link, hf CLI and curl.
- Browser
- Download file 581 Bytes
-
https://huggingface.co/spaces/king-eagle/chatbot-demo/resolve/main/app.py
- Command line
-
hf download hf://spaces/king-eagle/chatbot-demo/app.py
-
curl -L -o app.py https://huggingface.co/spaces/king-eagle/chatbot-demo/resolve/main/app.py
581 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| # Load your fine-tuned model from Hugging Face Hub | |
| model = pipeline("text-generation", model="your-huggingface-model-name") | |
| def chatbot(input_text): | |
| # Generate text response | |
| response = model(input_text, max_length=100, do_sample=True) | |
| return response[0]["generated_text"] | |
| # Create Gradio interface | |
| interface = gr.Interface( | |
| fn=chatbot, | |
| inputs="text", | |
| outputs="text", | |
| title="LLM Chatbot", | |
| description="A chatbot powered by fine-tuned LLM." | |
| ) | |
| if __name__ == "__main__": | |
| interface.launch() | |