Spaces:
Build error
Build error
Upload 2 files
Browse files- app.py +15 -0
- requirements.txt +3 -0
app.py
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Load chatbot model
|
| 5 |
+
chatbot = pipeline("text-generation", model="microsoft/DialoGPT-medium")
|
| 6 |
+
|
| 7 |
+
st.title("AI Chatbot")
|
| 8 |
+
st.write("Ask me anything!")
|
| 9 |
+
|
| 10 |
+
# User input
|
| 11 |
+
user_input = st.text_input("You:")
|
| 12 |
+
|
| 13 |
+
if user_input:
|
| 14 |
+
response = chatbot(user_input, max_length=100, num_return_sequences=1)
|
| 15 |
+
st.text_area("Bot:", response[0]['generated_text'])
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
transformers
|
| 3 |
+
torch
|