Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -8,6 +8,25 @@ from datetime import datetime, timedelta
|
|
8 |
from gtts import gTTS
|
9 |
from queue import Queue
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
# Global TTS queue
|
12 |
tts_queue = Queue()
|
13 |
|
@@ -329,10 +348,25 @@ iface = gr.Interface(
|
|
329 |
description="بحث حسب اسم الشركه - التاريخ - نمره الشاحنه"
|
330 |
)
|
331 |
|
332 |
-
#
|
333 |
if __name__ == "__main__":
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
share=
|
338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
from gtts import gTTS
|
9 |
from queue import Queue
|
10 |
|
11 |
+
# Monkey patch to fix the issue with bool not being iterable in get_type
|
12 |
+
# This patches the specific function that's causing the error
|
13 |
+
try:
|
14 |
+
import gradio_client.utils
|
15 |
+
original_get_type = gradio_client.utils.get_type
|
16 |
+
|
17 |
+
def patched_get_type(schema):
|
18 |
+
# Check if schema is a boolean and handle it
|
19 |
+
if isinstance(schema, bool):
|
20 |
+
return "bool"
|
21 |
+
# Otherwise use the original function
|
22 |
+
return original_get_type(schema)
|
23 |
+
|
24 |
+
# Apply the monkey patch
|
25 |
+
gradio_client.utils.get_type = patched_get_type
|
26 |
+
print("Successfully applied patch for gradio_client.utils.get_type")
|
27 |
+
except Exception as e:
|
28 |
+
print(f"Warning: Could not patch gradio_client.utils.get_type: {str(e)}")
|
29 |
+
|
30 |
# Global TTS queue
|
31 |
tts_queue = Queue()
|
32 |
|
|
|
348 |
description="بحث حسب اسم الشركه - التاريخ - نمره الشاحنه"
|
349 |
)
|
350 |
|
351 |
+
# Launch with defaults but with share=True for Spaces
|
352 |
if __name__ == "__main__":
|
353 |
+
try:
|
354 |
+
# First try with minimal parameters but share=True
|
355 |
+
print("Launching with share=True")
|
356 |
+
iface.launch(share=True)
|
357 |
+
except Exception as e:
|
358 |
+
print(f"Launch error with share=True: {str(e)}")
|
359 |
+
try:
|
360 |
+
# If that fails, try with server_name
|
361 |
+
print("Launching with server_name and share=True")
|
362 |
+
iface.launch(server_name="0.0.0.0", share=True)
|
363 |
+
except Exception as e:
|
364 |
+
print(f"Launch error with server_name and share=True: {str(e)}")
|
365 |
+
try:
|
366 |
+
# Last resort, try with default parameters
|
367 |
+
print("Launching with default parameters")
|
368 |
+
iface.launch()
|
369 |
+
except Exception as e:
|
370 |
+
print(f"Launch error with default parameters: {str(e)}")
|
371 |
+
# If all else fails, print an error message
|
372 |
+
print("All launch attempts failed. Please check the Gradio version and environment.")
|