Spaces:
Runtime error
Runtime error
Commit
·
72e54c6
1
Parent(s):
d506e11
Update app.py
Browse files
app.py
CHANGED
@@ -23,15 +23,21 @@ def generate_advice(prompt, model, tokenizer):
|
|
23 |
generated_advice = tokenizer.decode(output[0], skip_special_tokens=True)
|
24 |
return generated_advice
|
25 |
|
26 |
-
#
|
|
|
|
|
|
|
|
|
27 |
iface = gr.Interface(
|
28 |
-
fn=
|
29 |
inputs=gr.Textbox(),
|
30 |
outputs=gr.Textbox(),
|
31 |
live=True,
|
32 |
title="Depression Advice Generator",
|
33 |
-
description="Enter your feelings or ask for advice, and the
|
|
|
|
|
34 |
)
|
35 |
|
36 |
# Run the Gradio interface
|
37 |
-
iface.launch()
|
|
|
23 |
generated_advice = tokenizer.decode(output[0], skip_special_tokens=True)
|
24 |
return generated_advice
|
25 |
|
26 |
+
# Function to handle button click
|
27 |
+
def on_button_click(prompt):
|
28 |
+
return generate_advice(prompt, fine_tuned_model, tokenizer)
|
29 |
+
|
30 |
+
# Create a Gradio interface with a button
|
31 |
iface = gr.Interface(
|
32 |
+
fn=on_button_click,
|
33 |
inputs=gr.Textbox(),
|
34 |
outputs=gr.Textbox(),
|
35 |
live=True,
|
36 |
title="Depression Advice Generator",
|
37 |
+
description="Enter your feelings or ask for advice, and click the button to get supportive text.",
|
38 |
+
# Add a button
|
39 |
+
live_button="Generate Advice",
|
40 |
)
|
41 |
|
42 |
# Run the Gradio interface
|
43 |
+
iface.launch()
|