locorene1000 commited on
Commit
e7afa69
1 Parent(s): 06e5edd
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -50,8 +50,8 @@ def mejorar_resolucion(context, borrador, api_url, headers, max_length=1000):
50
 
51
  result = query(api_url, headers, payload)
52
 
53
- if result and isinstance(result, list) and 'generated_text' in result[0]:
54
- texto_generado = result[0]['generated_text']
55
  context += f"\n\n{texto_generado}"
56
  logging.info(f"Prompt: {prompt}\nGenerated: {texto_generado.strip()}")
57
  return texto_generado.strip(), context
@@ -93,7 +93,7 @@ async def api_predict(request: Request):
93
 
94
  # Crear y lanzar la interfaz de Gradio
95
  iface = gr.ChatInterface(predict)
96
- iface.launch()
97
 
98
  # Ejecutar la aplicaci贸n FastAPI
99
  if __name__ == "__main__":
 
50
 
51
  result = query(api_url, headers, payload)
52
 
53
+ if result and isinstance(result, dict) and result.get('generated_text'):
54
+ texto_generado = result['generated_text']
55
  context += f"\n\n{texto_generado}"
56
  logging.info(f"Prompt: {prompt}\nGenerated: {texto_generado.strip()}")
57
  return texto_generado.strip(), context
 
93
 
94
  # Crear y lanzar la interfaz de Gradio
95
  iface = gr.ChatInterface(predict)
96
+ iface.launch(share=True)
97
 
98
  # Ejecutar la aplicaci贸n FastAPI
99
  if __name__ == "__main__":