Download app.py from GFiaMon/zoom_test: direct link, hf CLI and curl.
- Browser
- Download file 2.35 kB
-
https://huggingface.co/spaces/GFiaMon/zoom_test/resolve/main/app.py
- Command line
-
hf download hf://spaces/GFiaMon/zoom_test/app.py
-
curl -L -o app.py https://huggingface.co/spaces/GFiaMon/zoom_test/resolve/main/app.py
2.35 kB
| # zoom_test_frontend.py | |
| import gradio as gr | |
| from zoom_test_backend import ZoomTranscriptionBackend | |
| # Initialize backend | |
| backend = ZoomTranscriptionBackend() | |
| def update_display(): | |
| """Function to get latest transcription from backend""" | |
| return backend.get_transcription() | |
| def handle_start_listening(): | |
| """Handle start button click""" | |
| return backend.start_listening() | |
| def handle_stop_listening(): | |
| """Handle stop button click""" | |
| return backend.stop_listening() | |
| def handle_clear_transcription(): | |
| """Handle clear button click""" | |
| return backend.clear_transcription() | |
| # Create Gradio interface | |
| with gr.Blocks(title="Zoom Transcription Test") as demo: | |
| gr.Markdown("# ๐ฏ Zoom Live Transcription Test") | |
| gr.Markdown("Frontend UI - Backend handles all Zoom logic") | |
| with gr.Row(): | |
| with gr.Column(): | |
| start_btn = gr.Button("๐ง Start Listening", variant="primary") | |
| stop_btn = gr.Button("โน๏ธ Stop Listening", variant="secondary") | |
| # In your frontend, add this button: | |
| refresh_btn = gr.Button("๐ Refresh Transcription") | |
| clear_btn = gr.Button("๐ Clear Text", variant="stop") | |
| status = gr.Textbox(label="Status", interactive=False) | |
| with gr.Row(): | |
| transcription_display = gr.Textbox( | |
| label="Live Transcription", | |
| lines=15, | |
| max_lines=20, | |
| interactive=False, | |
| placeholder="Transcription will appear here live..." | |
| ) | |
| # Auto-refresh the transcription display every second | |
| demo.load( | |
| fn=update_display, | |
| outputs=transcription_display, | |
| ) | |
| # Button actions | |
| start_btn.click( | |
| fn=handle_start_listening, | |
| outputs=status | |
| ) | |
| stop_btn.click( | |
| fn=handle_stop_listening, | |
| outputs=status | |
| ) | |
| # Add this click event: | |
| refresh_btn.click( | |
| fn=update_display, | |
| outputs=transcription_display | |
| ) | |
| clear_btn.click( | |
| fn=handle_clear_transcription, | |
| outputs=status | |
| ).then( | |
| fn=update_display, | |
| outputs=transcription_display | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch( | |
| server_name="0.0.0.0", | |
| server_port=7860, | |
| share=True | |
| ) |