metesttest001 commited on
Commit
6363086
1 Parent(s): 3edee5e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Carregando o modelo de chatbot do Hugging Face
5
+ model = pipeline("text-chat", device=0)
6
+
7
+ def chatbot_conversation(input_text):
8
+ # Resposta do chatbot
9
+ response = model(input_text)[0]['generated_text']
10
+ return response
11
+
12
+ # Interface do Gradio
13
+ iface = gr.Interface(
14
+ fn=chatbot_conversation,
15
+ inputs=gr.Textbox(lines=2, label="Pergunta"),
16
+ outputs=gr.Textbox(label="Resposta"),
17
+ title="Chatbot Simples",
18
+ description="Converse com o chatbot!"
19
+ )
20
+
21
+ # Executando a interface
22
+ iface.launch()