Spaces:
Running
on
Zero
Running
on
Zero
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -23,6 +23,7 @@ def gpu_decorator(func):
|
|
| 23 |
if spaces_available and GPU is not None:
|
| 24 |
return GPU(func)
|
| 25 |
return func
|
|
|
|
| 26 |
sys_prompt = """First output the the types of degradations in image briefly in <TYPE> <TYPE_END> tags,
|
| 27 |
and then output what effects do these degradation have on the image in <INFLUENCE> <INFLUENCE_END> tags,
|
| 28 |
then based on the strength of degradation, output an APPROPRIATE length for the reasoning process in <REASONING> <REASONING_END> tags,
|
|
@@ -30,6 +31,7 @@ sys_prompt = """First output the the types of degradations in image briefly in <
|
|
| 30 |
provides the user with the answer briefly in <ANSWER> <ANSWER_END>."""
|
| 31 |
|
| 32 |
project_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
| 33 |
|
| 34 |
if not is_spaces:
|
| 35 |
temp_dir = os.path.join(project_dir, ".gradio_temp")
|
|
@@ -335,11 +337,12 @@ if __name__ == "__main__":
|
|
| 335 |
|
| 336 |
if is_spaces:
|
| 337 |
print(f"π Running on Hugging Face Spaces: {os.getenv('SPACE_ID')}")
|
|
|
|
| 338 |
demo.launch(
|
| 339 |
theme=gr.themes.Soft(),
|
| 340 |
css=custom_css,
|
| 341 |
show_error=True,
|
| 342 |
-
allowed_paths=
|
| 343 |
)
|
| 344 |
else:
|
| 345 |
print(f"π Service is starting, please visit: http://localhost:7860")
|
|
|
|
| 23 |
if spaces_available and GPU is not None:
|
| 24 |
return GPU(func)
|
| 25 |
return func
|
| 26 |
+
|
| 27 |
sys_prompt = """First output the the types of degradations in image briefly in <TYPE> <TYPE_END> tags,
|
| 28 |
and then output what effects do these degradation have on the image in <INFLUENCE> <INFLUENCE_END> tags,
|
| 29 |
then based on the strength of degradation, output an APPROPRIATE length for the reasoning process in <REASONING> <REASONING_END> tags,
|
|
|
|
| 31 |
provides the user with the answer briefly in <ANSWER> <ANSWER_END>."""
|
| 32 |
|
| 33 |
project_dir = os.path.dirname(os.path.abspath(__file__))
|
| 34 |
+
temp_dir = None
|
| 35 |
|
| 36 |
if not is_spaces:
|
| 37 |
temp_dir = os.path.join(project_dir, ".gradio_temp")
|
|
|
|
| 337 |
|
| 338 |
if is_spaces:
|
| 339 |
print(f"π Running on Hugging Face Spaces: {os.getenv('SPACE_ID')}")
|
| 340 |
+
allowed_paths = [project_dir] if project_dir else None
|
| 341 |
demo.launch(
|
| 342 |
theme=gr.themes.Soft(),
|
| 343 |
css=custom_css,
|
| 344 |
show_error=True,
|
| 345 |
+
allowed_paths=allowed_paths
|
| 346 |
)
|
| 347 |
else:
|
| 348 |
print(f"π Service is starting, please visit: http://localhost:7860")
|