Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -156,24 +156,22 @@ def predict_image(image_input, location_data):
|
|
| 156 |
return translated_output_dict, formatted_output, status_lokasi
|
| 157 |
|
| 158 |
# --- UI INTERFACE ---
|
| 159 |
-
|
|
|
|
| 160 |
gr.Markdown("# 🚨 FirstAidLens")
|
| 161 |
|
| 162 |
-
# Hidden box untuk menampung koordinat
|
| 163 |
location_hidden = gr.Textbox(visible=False)
|
| 164 |
|
| 165 |
with gr.Row():
|
| 166 |
with gr.Column():
|
| 167 |
-
input_img = gr.Image(sources=["upload", "webcam"], type="pil", label="
|
| 168 |
-
|
| 169 |
-
btn_predict = gr.Button("Analisis Luka & Lokasi", variant="primary")
|
| 170 |
|
| 171 |
with gr.Column():
|
| 172 |
output_label = gr.Label(num_top_classes=3, label="Hasil Analisis")
|
| 173 |
output_markdown = gr.Markdown("### Panduan Pertolongan Pertama")
|
| 174 |
output_location = gr.Markdown("")
|
| 175 |
|
| 176 |
-
# Integrasi tombol dengan JS dan Python
|
| 177 |
btn_predict.click(
|
| 178 |
fn=predict_image,
|
| 179 |
inputs=[input_img, location_hidden],
|
|
@@ -182,4 +180,6 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="red", secondary_hue="slate")) a
|
|
| 182 |
)
|
| 183 |
|
| 184 |
if __name__ == "__main__":
|
| 185 |
-
demo.launch(
|
|
|
|
|
|
|
|
|
| 156 |
return translated_output_dict, formatted_output, status_lokasi
|
| 157 |
|
| 158 |
# --- UI INTERFACE ---
|
| 159 |
+
# Pindahkan theme ke launch() atau hapus dari Blocks untuk menghindari error versi 6.0
|
| 160 |
+
with gr.Blocks() as demo:
|
| 161 |
gr.Markdown("# 🚨 FirstAidLens")
|
| 162 |
|
|
|
|
| 163 |
location_hidden = gr.Textbox(visible=False)
|
| 164 |
|
| 165 |
with gr.Row():
|
| 166 |
with gr.Column():
|
| 167 |
+
input_img = gr.Image(sources=["upload", "webcam"], type="pil", label="Foto Luka")
|
| 168 |
+
btn_predict = gr.Button("Analisis Luka & Ambil Lokasi", variant="primary")
|
|
|
|
| 169 |
|
| 170 |
with gr.Column():
|
| 171 |
output_label = gr.Label(num_top_classes=3, label="Hasil Analisis")
|
| 172 |
output_markdown = gr.Markdown("### Panduan Pertolongan Pertama")
|
| 173 |
output_location = gr.Markdown("")
|
| 174 |
|
|
|
|
| 175 |
btn_predict.click(
|
| 176 |
fn=predict_image,
|
| 177 |
inputs=[input_img, location_hidden],
|
|
|
|
| 180 |
)
|
| 181 |
|
| 182 |
if __name__ == "__main__":
|
| 183 |
+
demo.launch(theme=gr.themes.Soft(primary_hue="red", secondary_hue="slate"))
|
| 184 |
+
# if __name__ == "__main__":
|
| 185 |
+
# demo.launch(server_name="0.0.0.0", server_port=7860)
|