Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,7 @@ def generate_response(prompt_template, **kwargs):
|
|
| 23 |
|
| 24 |
# Wrapper function for Gradio compatibility
|
| 25 |
def stream_response(prompt_template, **kwargs):
|
| 26 |
-
return
|
| 27 |
|
| 28 |
# Gradio app interface
|
| 29 |
with gr.Blocks() as app:
|
|
@@ -48,12 +48,13 @@ with gr.Blocks() as app:
|
|
| 48 |
)
|
| 49 |
# Button and output
|
| 50 |
button = gr.Button(f"{tab_name} Execute")
|
| 51 |
-
output = gr.
|
| 52 |
# Link button to the response wrapper
|
| 53 |
button.click(
|
| 54 |
fn=lambda *args: stream_response(prompt_template, **dict(zip([inp["key"] for inp in inputs], args))),
|
| 55 |
inputs=input_fields,
|
| 56 |
-
outputs=output
|
|
|
|
| 57 |
)
|
| 58 |
|
| 59 |
# Tabs for functionalities
|
|
@@ -103,4 +104,4 @@ with gr.Blocks() as app:
|
|
| 103 |
)
|
| 104 |
|
| 105 |
# Launch the app
|
| 106 |
-
app.launch(debug=True)
|
|
|
|
| 23 |
|
| 24 |
# Wrapper function for Gradio compatibility
|
| 25 |
def stream_response(prompt_template, **kwargs):
|
| 26 |
+
return generate_response(prompt_template, **kwargs)
|
| 27 |
|
| 28 |
# Gradio app interface
|
| 29 |
with gr.Blocks() as app:
|
|
|
|
| 48 |
)
|
| 49 |
# Button and output
|
| 50 |
button = gr.Button(f"{tab_name} Execute")
|
| 51 |
+
output = gr.Markdown(label="Output", placeholder="Generated response will appear here.")
|
| 52 |
# Link button to the response wrapper
|
| 53 |
button.click(
|
| 54 |
fn=lambda *args: stream_response(prompt_template, **dict(zip([inp["key"] for inp in inputs], args))),
|
| 55 |
inputs=input_fields,
|
| 56 |
+
outputs=output,
|
| 57 |
+
api_name=f"/{tab_name.lower().replace(' ', '_')}_execute"
|
| 58 |
)
|
| 59 |
|
| 60 |
# Tabs for functionalities
|
|
|
|
| 104 |
)
|
| 105 |
|
| 106 |
# Launch the app
|
| 107 |
+
app.launch(debug=True)
|