Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -189,21 +189,21 @@ def process_image(image, project_name):
|
|
| 189 |
|
| 190 |
# Return the detailed result in the desired format
|
| 191 |
result = f"""
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
{completed_work}
|
| 195 |
|
| 196 |
-
|
| 197 |
|
| 198 |
-
|
| 199 |
|
| 200 |
-
|
|
|
|
|
|
|
| 201 |
"""
|
| 202 |
|
| 203 |
-
return result, "Success", milestone, f"Confidence Score: {confidence_score}", percent_complete
|
| 204 |
|
| 205 |
except Exception as e:
|
| 206 |
-
return f"Error: {str(e)}", "Failure", "", "", 0
|
| 207 |
|
| 208 |
# Gradio UI with added styling
|
| 209 |
with gr.Blocks(css="""
|
|
@@ -230,6 +230,10 @@ with gr.Blocks(css="""
|
|
| 230 |
display: block;
|
| 231 |
margin: 0 auto;
|
| 232 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
""") as demo:
|
| 234 |
gr.Markdown("<h1 class='title'></h1>")
|
| 235 |
with gr.Row():
|
|
@@ -237,11 +241,11 @@ with gr.Blocks(css="""
|
|
| 237 |
project_name_input = gr.Textbox(label="Project Name (Required)", placeholder="e.g. Project_12345")
|
| 238 |
|
| 239 |
submit_button = gr.Button("Process Image")
|
| 240 |
-
output_text = gr.Textbox(label="Result")
|
| 241 |
upload_status = gr.Textbox(label="Upload Status")
|
| 242 |
milestone = gr.Textbox(label="Detected Milestone")
|
| 243 |
confidence = gr.Textbox(label="Confidence Score")
|
| 244 |
-
progress = gr.
|
| 245 |
|
| 246 |
submit_button.click(
|
| 247 |
fn=process_image,
|
|
|
|
| 189 |
|
| 190 |
# Return the detailed result in the desired format
|
| 191 |
result = f"""
|
| 192 |
+
Completed:
|
|
|
|
|
|
|
| 193 |
|
| 194 |
+
{completed_work}
|
| 195 |
|
| 196 |
+
Not Completed:
|
| 197 |
|
| 198 |
+
{not_completed_work}
|
| 199 |
+
|
| 200 |
+
Confidence Score: {confidence_score * 100}%
|
| 201 |
"""
|
| 202 |
|
| 203 |
+
return result, "Success", milestone, f"Confidence Score: {confidence_score}", f"{percent_complete}%"
|
| 204 |
|
| 205 |
except Exception as e:
|
| 206 |
+
return f"Error: {str(e)}", "Failure", "", "", "0%"
|
| 207 |
|
| 208 |
# Gradio UI with added styling
|
| 209 |
with gr.Blocks(css="""
|
|
|
|
| 230 |
display: block;
|
| 231 |
margin: 0 auto;
|
| 232 |
}
|
| 233 |
+
.result-textbox {
|
| 234 |
+
white-space: pre-wrap !important;
|
| 235 |
+
text-align: left !important;
|
| 236 |
+
}
|
| 237 |
""") as demo:
|
| 238 |
gr.Markdown("<h1 class='title'></h1>")
|
| 239 |
with gr.Row():
|
|
|
|
| 241 |
project_name_input = gr.Textbox(label="Project Name (Required)", placeholder="e.g. Project_12345")
|
| 242 |
|
| 243 |
submit_button = gr.Button("Process Image")
|
| 244 |
+
output_text = gr.Textbox(label="Result", elem_classes="result-textbox")
|
| 245 |
upload_status = gr.Textbox(label="Upload Status")
|
| 246 |
milestone = gr.Textbox(label="Detected Milestone")
|
| 247 |
confidence = gr.Textbox(label="Confidence Score")
|
| 248 |
+
progress = gr.Textbox(label="Completion Percentage", interactive=False)
|
| 249 |
|
| 250 |
submit_button.click(
|
| 251 |
fn=process_image,
|