Upload 2 files
Browse files- app.py +13 -0
- requirements.txt +3 -0
app.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Load GPT-2 from Hugging Face
|
| 5 |
+
chatbot = pipeline("text-generation", model="gpt2")
|
| 6 |
+
|
| 7 |
+
# Chat function
|
| 8 |
+
def chat(message):
|
| 9 |
+
response = chatbot(message, max_length=100, num_return_sequences=1)[0]['generated_text']
|
| 10 |
+
return response
|
| 11 |
+
|
| 12 |
+
# Create Gradio interface
|
| 13 |
+
gr.Interface(fn=chat, inputs="text", outputs="text", title="BekhaByte AI").launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
transformers
|
| 3 |
+
torch
|