Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,17 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
def responder(prompt):
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
demo = gr.Interface(fn=responder, inputs="text", outputs="text")
|
| 10 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
# Carga tu modelo (puede ser uno tuyo o uno de Hugging Face)
|
| 5 |
+
pipe = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.2", device=0)
|
| 6 |
|
| 7 |
def responder(prompt):
|
| 8 |
+
respuesta = pipe(prompt, max_new_tokens=300, do_sample=True, temperature=0.7)[0]['generated_text']
|
| 9 |
+
return respuesta
|
| 10 |
+
|
| 11 |
+
demo = gr.Interface(fn=responder,
|
| 12 |
+
inputs=gr.Textbox(label="Escribe tu mensaje"),
|
| 13 |
+
outputs=gr.Textbox(label="Respuesta"),
|
| 14 |
+
title="🤖 AmInside 1.0",
|
| 15 |
+
description="Tu asistente IA gratuito conectado a un Space")
|
| 16 |
|
|
|
|
| 17 |
demo.launch()
|