Spaces:
Sleeping
Sleeping
Update appImage.py
Browse files- appImage.py +5 -7
appImage.py
CHANGED
|
@@ -82,15 +82,14 @@ def create_pdf(content: dict, original_filename: str) -> str:
|
|
| 82 |
print(f"PDF creation error: {e}")
|
| 83 |
return ""
|
| 84 |
|
| 85 |
-
def process_image(
|
| 86 |
"""Handle image processing for Gradio interface"""
|
| 87 |
-
if
|
| 88 |
return "Please upload an image first", "Ready", None, None
|
| 89 |
|
| 90 |
-
file_path = file.name
|
| 91 |
-
original_filename = os.path.basename(file_path)
|
| 92 |
-
|
| 93 |
try:
|
|
|
|
|
|
|
| 94 |
# Analyze image
|
| 95 |
result = analyze_image(file_path)
|
| 96 |
if "error" in result:
|
|
@@ -168,5 +167,4 @@ app = gr.mount_gradio_app(app, demo, path="/")
|
|
| 168 |
|
| 169 |
@app.get("/")
|
| 170 |
def redirect_to_interface():
|
| 171 |
-
return RedirectResponse(url="/")
|
| 172 |
-
|
|
|
|
| 82 |
print(f"PDF creation error: {e}")
|
| 83 |
return ""
|
| 84 |
|
| 85 |
+
def process_image(file_path: str, enable_tts: bool):
|
| 86 |
"""Handle image processing for Gradio interface"""
|
| 87 |
+
if not file_path:
|
| 88 |
return "Please upload an image first", "Ready", None, None
|
| 89 |
|
|
|
|
|
|
|
|
|
|
| 90 |
try:
|
| 91 |
+
original_filename = os.path.basename(file_path)
|
| 92 |
+
|
| 93 |
# Analyze image
|
| 94 |
result = analyze_image(file_path)
|
| 95 |
if "error" in result:
|
|
|
|
| 167 |
|
| 168 |
@app.get("/")
|
| 169 |
def redirect_to_interface():
|
| 170 |
+
return RedirectResponse(url="/")
|
|
|