Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -140,7 +140,7 @@ def inference(video, step_number):
|
|
| 140 |
return f"An error occurred during analysis: {str(e)}"
|
| 141 |
|
| 142 |
def create_interface():
|
| 143 |
-
"""Creates the Gradio interface for the Manufacturing Delay Analysis System."""
|
| 144 |
with gr.Blocks() as demo:
|
| 145 |
gr.Markdown("""
|
| 146 |
# Manufacturing Delay Analysis System
|
|
@@ -150,17 +150,28 @@ def create_interface():
|
|
| 150 |
|
| 151 |
with gr.Row():
|
| 152 |
with gr.Column():
|
| 153 |
-
video = gr.Video(label="Upload Manufacturing Video", sources=["upload"]
|
| 154 |
step_number = gr.Dropdown(
|
| 155 |
choices=list(DELAY_REASONS.keys()),
|
| 156 |
-
label="Manufacturing Step"
|
| 157 |
-
value="Step 8"
|
| 158 |
)
|
| 159 |
analyze_btn = gr.Button("Analyze Delay", variant="primary")
|
| 160 |
|
| 161 |
with gr.Column():
|
| 162 |
output = gr.Textbox(label="Analysis Result", lines=10)
|
| 163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
analyze_btn.click(
|
| 165 |
fn=inference,
|
| 166 |
inputs=[video, step_number],
|
|
@@ -172,3 +183,4 @@ def create_interface():
|
|
| 172 |
if __name__ == "__main__":
|
| 173 |
demo = create_interface()
|
| 174 |
demo.launch(share=True)
|
|
|
|
|
|
| 140 |
return f"An error occurred during analysis: {str(e)}"
|
| 141 |
|
| 142 |
def create_interface():
|
| 143 |
+
"""Creates the Gradio interface for the Manufacturing Delay Analysis System with examples."""
|
| 144 |
with gr.Blocks() as demo:
|
| 145 |
gr.Markdown("""
|
| 146 |
# Manufacturing Delay Analysis System
|
|
|
|
| 150 |
|
| 151 |
with gr.Row():
|
| 152 |
with gr.Column():
|
| 153 |
+
video = gr.Video(label="Upload Manufacturing Video", sources=["upload"])
|
| 154 |
step_number = gr.Dropdown(
|
| 155 |
choices=list(DELAY_REASONS.keys()),
|
| 156 |
+
label="Manufacturing Step"
|
|
|
|
| 157 |
)
|
| 158 |
analyze_btn = gr.Button("Analyze Delay", variant="primary")
|
| 159 |
|
| 160 |
with gr.Column():
|
| 161 |
output = gr.Textbox(label="Analysis Result", lines=10)
|
| 162 |
|
| 163 |
+
# Add examples
|
| 164 |
+
examples = [
|
| 165 |
+
["delay_tyre.mp4", "Step 8"],
|
| 166 |
+
["delay_tyre2.mp4", "Step 6"]
|
| 167 |
+
]
|
| 168 |
+
|
| 169 |
+
gr.Examples(
|
| 170 |
+
examples=examples,
|
| 171 |
+
inputs=[video, step_number],
|
| 172 |
+
cache_examples=False
|
| 173 |
+
)
|
| 174 |
+
|
| 175 |
analyze_btn.click(
|
| 176 |
fn=inference,
|
| 177 |
inputs=[video, step_number],
|
|
|
|
| 183 |
if __name__ == "__main__":
|
| 184 |
demo = create_interface()
|
| 185 |
demo.launch(share=True)
|
| 186 |
+
|