Update app.py
Browse files
app.py
CHANGED
@@ -227,6 +227,7 @@ with gr.Blocks(css=css) as demo:
|
|
227 |
output_text = gr.Markdown(label="Output Text", show_copy_button=True, elem_classes="output-text")
|
228 |
redirect_message = gr.Markdown(visible=False, elem_classes="redirect-message")
|
229 |
test_counter_display = gr.Markdown(visible=True, label="Test Counter")
|
|
|
230 |
|
231 |
# Toggle visibility of custom instruction based on selected type
|
232 |
def toggle_custom_instruction(type_selection):
|
@@ -255,7 +256,7 @@ with gr.Blocks(css=css) as demo:
|
|
255 |
gr.update(visible=False),
|
256 |
gr.update(interactive=True),
|
257 |
f"You have {remaining_tests} free test(s) remaining today.",
|
258 |
-
|
259 |
)
|
260 |
else:
|
261 |
redirect_text = f"""
|
@@ -281,7 +282,7 @@ with gr.Blocks(css=css) as demo:
|
|
281 |
gr.update(visible=True, value=redirect_text),
|
282 |
gr.update(interactive=False),
|
283 |
"You've used all your free tests for today. We invite you to book a demo for full access!",
|
284 |
-
|
285 |
)
|
286 |
else:
|
287 |
redirect_text = f"""
|
@@ -307,23 +308,16 @@ with gr.Blocks(css=css) as demo:
|
|
307 |
gr.update(visible=True, value=redirect_text),
|
308 |
gr.update(interactive=False),
|
309 |
"All free tests used. We invite you to book a demo for full access!",
|
310 |
-
|
311 |
)
|
312 |
|
|
|
313 |
# Update the outputs of the submit button click event
|
314 |
submit_btn.click(
|
315 |
handle_submit,
|
316 |
inputs=[input_img, description_type, custom_instruction],
|
317 |
-
outputs=[output_text, redirect_message, submit_btn, test_counter_display,
|
318 |
)
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
with gr.Column():
|
323 |
-
output_text = gr.Markdown(label="Output Text", show_copy_button=True, elem_classes="output-text")
|
324 |
-
redirect_message = gr.Markdown(visible=False, elem_classes="redirect-message")
|
325 |
-
test_counter_display = gr.Markdown(visible=True, label="Test Counter")
|
326 |
-
user_id_display = gr.Markdown(visible=True, label="User ID") # Add this line
|
327 |
|
328 |
# Launch Gradio app
|
329 |
demo.queue(api_open=False)
|
|
|
227 |
output_text = gr.Markdown(label="Output Text", show_copy_button=True, elem_classes="output-text")
|
228 |
redirect_message = gr.Markdown(visible=False, elem_classes="redirect-message")
|
229 |
test_counter_display = gr.Markdown(visible=True, label="Test Counter")
|
230 |
+
user_id_display = gr.Markdown(visible=True, label="User ID")
|
231 |
|
232 |
# Toggle visibility of custom instruction based on selected type
|
233 |
def toggle_custom_instruction(type_selection):
|
|
|
256 |
gr.update(visible=False),
|
257 |
gr.update(interactive=True),
|
258 |
f"You have {remaining_tests} free test(s) remaining today.",
|
259 |
+
f"User ID: {user_id}"
|
260 |
)
|
261 |
else:
|
262 |
redirect_text = f"""
|
|
|
282 |
gr.update(visible=True, value=redirect_text),
|
283 |
gr.update(interactive=False),
|
284 |
"You've used all your free tests for today. We invite you to book a demo for full access!",
|
285 |
+
f"User ID: {user_id}"
|
286 |
)
|
287 |
else:
|
288 |
redirect_text = f"""
|
|
|
308 |
gr.update(visible=True, value=redirect_text),
|
309 |
gr.update(interactive=False),
|
310 |
"All free tests used. We invite you to book a demo for full access!",
|
311 |
+
f"User ID: {user_id}"
|
312 |
)
|
313 |
|
314 |
+
|
315 |
# Update the outputs of the submit button click event
|
316 |
submit_btn.click(
|
317 |
handle_submit,
|
318 |
inputs=[input_img, description_type, custom_instruction],
|
319 |
+
outputs=[output_text, redirect_message, submit_btn, test_counter_display, user_id_display]
|
320 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
|
322 |
# Launch Gradio app
|
323 |
demo.queue(api_open=False)
|