Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,18 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
|
| 5 |
|
| 6 |
def chatbot(input_text):
|
| 7 |
-
generated_text =
|
| 8 |
-
return
|
| 9 |
|
| 10 |
chatbot_app = gr.Interface(
|
| 11 |
-
chatbot,
|
| 12 |
inputs=gr.Textbox(lines=2, label="You:"),
|
| 13 |
-
outputs=
|
| 14 |
-
title="Chatbot UI"
|
|
|
|
| 15 |
)
|
| 16 |
|
| 17 |
if __name__ == "__main__":
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
generator = pipeline(task="text-generation", model="EleutherAI/gpt-neo-2.7B")
|
| 5 |
|
| 6 |
def chatbot(input_text):
|
| 7 |
+
generated_text = generator(input_text, max_length=50)
|
| 8 |
+
return generated_text[0]["generated_text"]
|
| 9 |
|
| 10 |
chatbot_app = gr.Interface(
|
| 11 |
+
fn=chatbot,
|
| 12 |
inputs=gr.Textbox(lines=2, label="You:"),
|
| 13 |
+
outputs="text",
|
| 14 |
+
title="Chatbot UI",
|
| 15 |
+
theme="huggingface"
|
| 16 |
)
|
| 17 |
|
| 18 |
if __name__ == "__main__":
|