Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -36,10 +36,10 @@ def text_prompt(request, page_url, contraseña, temp):
|
|
36 |
response_text = response.choices[0].text
|
37 |
# clean the response text
|
38 |
response_text = re.sub(r'\s+', ' ', response_text)
|
39 |
-
return response_text, num_tokens
|
40 |
except Exception as e:
|
41 |
-
return f"--- Ha ocurrido un error al procesar la solicitud: {e} ---", num_tokens
|
42 |
-
return "--- Max number of tokens ---", num_tokens
|
43 |
|
44 |
# define the gradio interface
|
45 |
iface = gr.Interface(
|
@@ -49,7 +49,7 @@ iface = gr.Interface(
|
|
49 |
gr.Textbox(lines=1, placeholder="Enter your API-key here...", label="API-Key:", type="password"),
|
50 |
gr.Slider(0.0,1.0, value=0.3, label="Temperature:")
|
51 |
],
|
52 |
-
outputs=[gr.Textbox(label="Output:"), gr.Textbox(label="Tokens:")],
|
53 |
examples=[["Summarize the following text as a list:","https://blog.google/outreach-initiatives/google-org/our-commitment-on-using-ai-to-accelerate-progress-on-global-development-goals/","",0.3],
|
54 |
["Generate a summary of the following text. Give me an overview of main business impact from the text following this template:\n- Summary:\n- Business Impact:\n- Companies:", "https://ai.googleblog.com/2019/10/quantum-supremacy-using-programmable.html","",0.7]
|
55 |
],
|
|
|
36 |
response_text = response.choices[0].text
|
37 |
# clean the response text
|
38 |
response_text = re.sub(r'\s+', ' ', response_text)
|
39 |
+
return page.text, response_text, num_tokens
|
40 |
except Exception as e:
|
41 |
+
return "", f"--- Ha ocurrido un error al procesar la solicitud: {e} ---", num_tokens
|
42 |
+
return "", "--- Max number of tokens ---", num_tokens
|
43 |
|
44 |
# define the gradio interface
|
45 |
iface = gr.Interface(
|
|
|
49 |
gr.Textbox(lines=1, placeholder="Enter your API-key here...", label="API-Key:", type="password"),
|
50 |
gr.Slider(0.0,1.0, value=0.3, label="Temperature:")
|
51 |
],
|
52 |
+
outputs=[gr.Textbox(label="Input:"), gr.Textbox(label="Output:"), gr.Textbox(label="Tokens:")],
|
53 |
examples=[["Summarize the following text as a list:","https://blog.google/outreach-initiatives/google-org/our-commitment-on-using-ai-to-accelerate-progress-on-global-development-goals/","",0.3],
|
54 |
["Generate a summary of the following text. Give me an overview of main business impact from the text following this template:\n- Summary:\n- Business Impact:\n- Companies:", "https://ai.googleblog.com/2019/10/quantum-supremacy-using-programmable.html","",0.7]
|
55 |
],
|