Spaces:
Running
Running
Upload 2 files
Browse files- app.py +22 -0
- requirements.txt +4 -0
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load the Pythia-410m chatbot model
|
5 |
+
chatbot = pipeline("text-generation", model="AventIQ-AI/pythia-410m-chatbot")
|
6 |
+
|
7 |
+
def chat_response(prompt):
|
8 |
+
response = chatbot(prompt, max_length=200, num_return_sequences=1)
|
9 |
+
return response[0]['generated_text']
|
10 |
+
|
11 |
+
# Create Gradio interface
|
12 |
+
iface = gr.Interface(
|
13 |
+
fn=chat_response,
|
14 |
+
inputs=gr.Textbox(lines=3, placeholder="Ask me anything..."),
|
15 |
+
outputs=gr.Textbox(label="Chatbot Response"),
|
16 |
+
title="Pythia-410m Chatbot",
|
17 |
+
description="An AI-powered chatbot using the Pythia-410m model fine-tuned by AventIQ.",
|
18 |
+
)
|
19 |
+
|
20 |
+
# Launch the app
|
21 |
+
if __name__ == "__main__":
|
22 |
+
iface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
torch
|
2 |
+
transformers
|
3 |
+
sentencepiece
|
4 |
+
gradio
|