Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,19 @@
|
|
1 |
-
import gradio as gr
|
2 |
from transformers import pipeline
|
|
|
3 |
|
4 |
-
|
5 |
-
generator = pipeline("text-generation", model="microsoft/DialoGPT-medium")
|
6 |
|
7 |
-
def
|
8 |
-
|
9 |
-
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
|
4 |
+
chatbot = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.1", trust_remote_code=True)
|
|
|
5 |
|
6 |
+
def predict(user_input, history=[]):
|
7 |
+
prompt = user_input
|
8 |
+
response = chatbot(prompt, max_new_tokens=200, do_sample=True)[0]["generated_text"]
|
9 |
+
history.append((user_input, response))
|
10 |
+
return history, history
|
11 |
|
12 |
+
gr.Interface(
|
13 |
+
fn=predict,
|
14 |
+
inputs=["text", "state"],
|
15 |
+
outputs=["chatbot", "state"],
|
16 |
+
title="Mi Chatbot Sexy",
|
17 |
+
description="Habla con una IA encantadora.",
|
18 |
+
theme="finlaymacklon/boxy_violet"
|
19 |
+
).launch()
|