Spaces:
Runtime error
Runtime error
import gradio as gr | |
from processing import process_input | |
from visualization import update_visibility_and_charts | |
def create_interface(): | |
with gr.Blocks() as iface: | |
gr.Markdown("# Personality Analysis Classification") | |
gr.Markdown("Upload a Video, TXT, or PDF file.") | |
with gr.Row(): | |
input_file = gr.File(label="Upload File (TXT, PDF, or Video)") | |
with gr.Column(): | |
progress = gr.Progress() | |
status_text = gr.Textbox(label="Status") | |
execution_time = gr.Textbox(label="Execution Time", visible=False) | |
detected_language = gr.Textbox(label="Detected Language", visible=False) | |
# Create placeholders for charts and explanations | |
charts_and_explanations = [] | |
for _ in range(6): # 3 analysis types * 2 speakers | |
with gr.Row(): | |
charts_and_explanations.append(gr.Plot(visible=False)) | |
charts_and_explanations.append(gr.Textbox(visible=False)) | |
def process_and_update(input_file): | |
# Process the input | |
results = process_input(input_file, progress=gr.Progress()) | |
# Create and update charts and explanations | |
return update_visibility_and_charts(*results) | |
input_file.upload( | |
fn=process_and_update, | |
inputs=[input_file], | |
outputs=[status_text, execution_time, detected_language] + charts_and_explanations | |
) | |
return iface | |
iface = create_interface() | |
# Launch the app | |
if __name__ == "__main__": | |
iface.launch() |