Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# Carga el modelo (TinyLlama en este caso)
|
5 |
pipe = pipeline("text-generation", model="TinyLlama/TinyLlama-1.1B-Chat-v1.0", device=-1)
|
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 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
description="Tu asistente IA gratuito en Hugging Face 🤘"
|
17 |
-
)
|
18 |
|
19 |
-
# ⚠️ No pongas share=True en Hugging Face Spaces
|
20 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
|
|
4 |
pipe = pipeline("text-generation", model="TinyLlama/TinyLlama-1.1B-Chat-v1.0", device=-1)
|
5 |
|
6 |
def responder(prompt):
|
7 |
respuesta = pipe(prompt, max_new_tokens=300, do_sample=True, temperature=0.7)[0]['generated_text']
|
8 |
return respuesta
|
9 |
|
10 |
+
with gr.Blocks() as demo:
|
11 |
+
gr.Markdown("## 🤖 AmInside 1.0\nTu asistente IA gratuito en Hugging Face")
|
12 |
+
entrada = gr.Textbox(label="Escribe tu mensaje")
|
13 |
+
salida = gr.Textbox(label="Respuesta")
|
14 |
+
entrada.submit(fn=responder, inputs=entrada, outputs=salida)
|
|
|
|
|
15 |
|
|
|
16 |
demo.launch()
|