Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,8 +4,6 @@ from PIL import Image
|
|
| 4 |
import json
|
| 5 |
import spaces
|
| 6 |
|
| 7 |
-
@spaces.GPU
|
| 8 |
-
|
| 9 |
# === Model Mapping ===
|
| 10 |
MODEL_MAP = {
|
| 11 |
"Qwen": "models.qwen",
|
|
@@ -159,7 +157,7 @@ def process_single_image(model_name, image_file):
|
|
| 159 |
|
| 160 |
return image, json_output, pretty_output
|
| 161 |
|
| 162 |
-
# === Gradio
|
| 163 |
iface = gr.Interface(
|
| 164 |
fn=process_single_image,
|
| 165 |
inputs=[
|
|
@@ -176,7 +174,10 @@ iface = gr.Interface(
|
|
| 176 |
allow_flagging="never"
|
| 177 |
)
|
| 178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
if __name__ == "__main__":
|
| 180 |
main()
|
| 181 |
-
|
| 182 |
-
#iface.launch(share=True)
|
|
|
|
| 4 |
import json
|
| 5 |
import spaces
|
| 6 |
|
|
|
|
|
|
|
| 7 |
# === Model Mapping ===
|
| 8 |
MODEL_MAP = {
|
| 9 |
"Qwen": "models.qwen",
|
|
|
|
| 157 |
|
| 158 |
return image, json_output, pretty_output
|
| 159 |
|
| 160 |
+
# === Gradio UI
|
| 161 |
iface = gr.Interface(
|
| 162 |
fn=process_single_image,
|
| 163 |
inputs=[
|
|
|
|
| 174 |
allow_flagging="never"
|
| 175 |
)
|
| 176 |
|
| 177 |
+
# === Enable GPU mode and launch
|
| 178 |
+
@spaces.GPU
|
| 179 |
+
def main():
|
| 180 |
+
iface.launch()
|
| 181 |
+
|
| 182 |
if __name__ == "__main__":
|
| 183 |
main()
|
|
|
|
|
|