therehack31 commited on
Commit
7beb238
·
1 Parent(s): 3ab89e0

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ model = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct")
5
+
6
+ def chat(message):
7
+ prompt = "Responde de forma directa y sin rodeos: " + message
8
+
9
+ result = model(
10
+ prompt,
11
+ max_new_tokens=150,
12
+ temperature=0.9
13
+ )
14
+
15
+ return result[0]["generated_text"]
16
+
17
+ gr.Interface(
18
+ fn=chat,
19
+ inputs=gr.Textbox(placeholder="Escribe lo que quieras..."),
20
+ outputs="text",
21
+ title="Mi IA"
22
+ ).launch()