Spaces:
Runtime error
Runtime error
add zerogpu
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
import re
|
3 |
import random
|
4 |
import gradio as gr
|
@@ -10,7 +11,6 @@ from agent_tools import RestorationToolkit
|
|
10 |
|
11 |
# download tools ckpts
|
12 |
from huggingface_hub import hf_hub_download, list_files_info
|
13 |
-
import os
|
14 |
|
15 |
# 目标目录
|
16 |
target_dir = "JarvisIR/checkpoints/agent_tools"
|
@@ -198,6 +198,7 @@ def resize_image_to_original(processed_image_path, original_size):
|
|
198 |
return output_path
|
199 |
return processed_image_path
|
200 |
|
|
|
201 |
def get_llm_response_streaming(image_path):
|
202 |
"""
|
203 |
Get streaming response from LLM for image analysis
|
@@ -235,6 +236,7 @@ def get_llm_response_streaming(image_path):
|
|
235 |
|
236 |
return streamer
|
237 |
|
|
|
238 |
def process_image_with_tools(image_path, models, original_size):
|
239 |
"""
|
240 |
Process image using the tool engine and restore to original size
|
|
|
1 |
import os
|
2 |
+
import spaces
|
3 |
import re
|
4 |
import random
|
5 |
import gradio as gr
|
|
|
11 |
|
12 |
# download tools ckpts
|
13 |
from huggingface_hub import hf_hub_download, list_files_info
|
|
|
14 |
|
15 |
# 目标目录
|
16 |
target_dir = "JarvisIR/checkpoints/agent_tools"
|
|
|
198 |
return output_path
|
199 |
return processed_image_path
|
200 |
|
201 |
+
@spaces.GPU(duration=150)
|
202 |
def get_llm_response_streaming(image_path):
|
203 |
"""
|
204 |
Get streaming response from LLM for image analysis
|
|
|
236 |
|
237 |
return streamer
|
238 |
|
239 |
+
@spaces.GPU(duration=150)
|
240 |
def process_image_with_tools(image_path, models, original_size):
|
241 |
"""
|
242 |
Process image using the tool engine and restore to original size
|