Download app.py from BekhaByteoff/BekhaByteAI: direct link, hf CLI and curl.
- Browser
- Download file 411 Bytes
-
https://huggingface.co/BekhaByteoff/BekhaByteAI/resolve/main/app.py
- Command line
-
hf download hf://BekhaByteoff/BekhaByteAI/app.py
-
curl -L -o app.py https://huggingface.co/BekhaByteoff/BekhaByteAI/resolve/main/app.py
411 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| # Load GPT-2 from Hugging Face | |
| chatbot = pipeline("text-generation", model="gpt2") | |
| # Chat function | |
| def chat(message): | |
| response = chatbot(message, max_length=100, num_return_sequences=1)[0]['generated_text'] | |
| return response | |
| # Create Gradio interface | |
| gr.Interface(fn=chat, inputs="text", outputs="text", title="BekhaByte AI").launch() | |