Hodely commited on
Commit
158eb11
·
verified ·
1 Parent(s): b4342ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -1,19 +1,20 @@
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=150, do_sample=True)[0]['generated_text']
8
  return respuesta
9
 
10
  demo = gr.Interface(
11
- fn=responder,
12
- inputs=gr.Textbox(label="Escribe tu mensaje"),
13
  outputs=gr.Textbox(label="Respuesta"),
14
- title="🤖 AmInside 1.0 (TinyLlama)",
15
- description="Modelo TinyLlama en CPU, sin errores y sin gastar dinero 🐑"
16
  )
17
 
18
- demo.launch(share=True)
19
-
 
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
  demo = gr.Interface(
12
+ fn=responder,
13
+ inputs=gr.Textbox(label="Escribe tu mensaje"),
14
  outputs=gr.Textbox(label="Respuesta"),
15
+ title="🤖 AmInside 1.0",
16
+ description="Tu asistente IA gratuito en Hugging Face 🤘"
17
  )
18
 
19
+ # ⚠️ No pongas share=True en Hugging Face Spaces
20
+ demo.launch()