GrupoCEJA commited on
Commit
c3b01dd
·
verified ·
1 Parent(s): 22183a4

Ajustar función responder para modelo tiny-gpt2

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -4,9 +4,10 @@ from transformers import pipeline
4
  generator = pipeline("text-generation", model="sshleifer/tiny-gpt2")
5
 
6
  def responder(texto_usuario):
7
- prompt = f"Tú eres AURA, acrónimo de Asistente de Unión y Regulación Afectiva, un asistente emocional escolar muy amable de la aplicación CEJASOS. Ayuda a los estudiantes a sentirse escuchados sin juzgar y de una manera en la que se sientan seguros contigo. Si alguien dice: '{texto_usuario}', tú respondes:"
8
- resultado = generator(prompt, max_length=150, do_sample=True, temperature=0.7)[0]["text"]
9
- return resultado[len(prompt):]
 
10
 
11
  iface = gr.Interface(
12
  fn=responder,
 
4
  generator = pipeline("text-generation", model="sshleifer/tiny-gpt2")
5
 
6
  def responder(texto_usuario):
7
+ prompt = f"Tú eres AURA, un asistente emocional escolar muy amable. Ayuda a los estudiantes a sentirse escuchados sin juzgar. Si alguien dice: '{texto_usuario}', tú respondes:"
8
+ outputs = generator(prompt, max_length=50)
9
+ return outputs[0]["text"]
10
+
11
 
12
  iface = gr.Interface(
13
  fn=responder,