Spaces:
Runtime error
Runtime error
File size: 1,632 Bytes
ddf0a26 b444514 dd3c001 a3e8bd9 708d13d 9433c15 a3e8bd9 8fa4560 30efc24 78f6fde 8244923 466cd11 d5fbbf5 466cd11 78f6fde e827595 a3e8bd9 8244923 a3e8bd9 30efc24 a3e8bd9 66acfba 5e7b13d 466cd11 323fa1b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
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() |