Spaces:
Sleeping
Sleeping
modified app.py
Browse files
app.py
CHANGED
|
@@ -76,15 +76,27 @@ for key, folder in FOLDER_MAP.items():
|
|
| 76 |
with open(index_path, 'w') as f:
|
| 77 |
json.dump(files, f)
|
| 78 |
print(f"Created {index_path} with {len(files)} files")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
original_html = "<h1>Error: viewer_v2.html not found</h1>"
|
| 88 |
|
| 89 |
# Create Gradio interface
|
| 90 |
with gr.Blocks(title="Report Viewer", theme=gr.themes.Soft()) as demo:
|
|
@@ -140,5 +152,7 @@ with gr.Blocks(title="Report Viewer", theme=gr.themes.Soft()) as demo:
|
|
| 140 |
if __name__ == "__main__":
|
| 141 |
# Launch with file serving enabled
|
| 142 |
demo.launch(
|
| 143 |
-
|
|
|
|
|
|
|
| 144 |
)
|
|
|
|
| 76 |
with open(index_path, 'w') as f:
|
| 77 |
json.dump(files, f)
|
| 78 |
print(f"Created {index_path} with {len(files)} files")
|
| 79 |
+
else:
|
| 80 |
+
print(f"WARNING: Folder {folder} does not exist")
|
| 81 |
+
|
| 82 |
+
# Read HTML file - prova diversi percorsi possibili
|
| 83 |
+
html_paths = ["Viewer/viewer_v2.html", "viewer_v2.html", "./viewer_v2.html"]
|
| 84 |
+
original_html = None
|
| 85 |
+
|
| 86 |
+
for html_path in html_paths:
|
| 87 |
+
if os.path.exists(html_path):
|
| 88 |
+
with open(html_path, "r", encoding="utf-8") as f:
|
| 89 |
+
original_html = f.read()
|
| 90 |
+
print(f"✅ Found HTML at: {html_path}")
|
| 91 |
+
break
|
| 92 |
|
| 93 |
+
if original_html is None:
|
| 94 |
+
print("❌ ERROR: viewer_v2.html not found in any expected location!")
|
| 95 |
+
print(f"Current directory: {os.getcwd()}")
|
| 96 |
+
print(f"Files in current directory: {os.listdir('.')}")
|
| 97 |
+
if os.path.exists('Viewer'):
|
| 98 |
+
print(f"Files in Viewer directory: {os.listdir('Viewer')}")
|
| 99 |
+
original_html = "<h1>Error: viewer_v2.html not found</h1><p>Please check the file structure.</p>"
|
|
|
|
| 100 |
|
| 101 |
# Create Gradio interface
|
| 102 |
with gr.Blocks(title="Report Viewer", theme=gr.themes.Soft()) as demo:
|
|
|
|
| 152 |
if __name__ == "__main__":
|
| 153 |
# Launch with file serving enabled
|
| 154 |
demo.launch(
|
| 155 |
+
server_name="0.0.0.0", # Necessario per Hugging Face Spaces
|
| 156 |
+
server_port=7860, # Porta standard di Gradio
|
| 157 |
+
allowed_paths=[".", "Viewer", "Viewer/Data"] # Permetti accesso a più cartelle
|
| 158 |
)
|