Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
pipeline = pipeline(task="text-generation", model="starcoder2-15b")
|
| 5 |
+
|
| 6 |
+
def chatbot(input_text):
|
| 7 |
+
generated_text = pipeline(input_text, max_length=50)
|
| 8 |
+
return input_text, "Chatbot: " + generated_text[0]["generated_text"]
|
| 9 |
+
|
| 10 |
+
chatbot_app = gr.Interface(
|
| 11 |
+
chatbot,
|
| 12 |
+
inputs=gr.Textbox(lines=2, label="You:"),
|
| 13 |
+
outputs=gr.Textbox(label="Chatbot:", placeholder="Chatbot's response will appear here..."),
|
| 14 |
+
title="Chatbot UI"
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
if __name__ == "__main__":
|
| 18 |
+
chatbot_app.launch()
|