Spaces:
Runtime error
Runtime error
Commit ·
2515529
1
Parent(s): 86892b5
Tried updating Gradio
Browse files
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 💢
|
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: red
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: true
|
| 10 |
---
|
|
|
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: red
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.29.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: true
|
| 10 |
---
|
app.py
CHANGED
|
@@ -9,6 +9,8 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, AutoConfig
|
|
| 9 |
import time
|
| 10 |
import nltk
|
| 11 |
import io
|
|
|
|
|
|
|
| 12 |
|
| 13 |
from transformers import BlipProcessor, BlipForConditionalGeneration
|
| 14 |
from parler_tts import ParlerTTSForConditionalGeneration
|
|
@@ -264,17 +266,40 @@ def create_app():
|
|
| 264 |
|
| 265 |
if __name__ == "__main__":
|
| 266 |
try:
|
| 267 |
-
#
|
| 268 |
-
|
| 269 |
-
|
| 270 |
|
| 271 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 272 |
app = create_app()
|
| 273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
except Exception as e:
|
| 275 |
print(f"Fatal error: {str(e)}")
|
| 276 |
# If all else fails, create a minimal app
|
| 277 |
with gr.Blocks() as minimal_app:
|
| 278 |
gr.Markdown("# AsianMOM: Fatal Error")
|
| 279 |
gr.Markdown(f"Fatal error: {str(e)}")
|
| 280 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
import time
|
| 10 |
import nltk
|
| 11 |
import io
|
| 12 |
+
import sys
|
| 13 |
+
import pkg_resources
|
| 14 |
|
| 15 |
from transformers import BlipProcessor, BlipForConditionalGeneration
|
| 16 |
from parler_tts import ParlerTTSForConditionalGeneration
|
|
|
|
| 266 |
|
| 267 |
if __name__ == "__main__":
|
| 268 |
try:
|
| 269 |
+
# Check and report Gradio version
|
| 270 |
+
gradio_version = pkg_resources.get_distribution("gradio").version
|
| 271 |
+
print(f"Using Gradio version: {gradio_version}")
|
| 272 |
|
| 273 |
+
# Try to download required resources
|
| 274 |
+
try:
|
| 275 |
+
os.system('python -m unidic download')
|
| 276 |
+
nltk.download('averaged_perceptron_tagger_eng')
|
| 277 |
+
except Exception as e:
|
| 278 |
+
print(f"Warning: Could not download some resources: {str(e)}")
|
| 279 |
+
|
| 280 |
+
# Create the app
|
| 281 |
app = create_app()
|
| 282 |
+
|
| 283 |
+
# Try multiple launch configurations if needed
|
| 284 |
+
try:
|
| 285 |
+
# First attempt with share=True
|
| 286 |
+
print("Launching app with share=True and debug=True")
|
| 287 |
+
app.launch(share=True, debug=True)
|
| 288 |
+
except ValueError as e:
|
| 289 |
+
if "localhost is not accessible" in str(e):
|
| 290 |
+
# Second attempt with server_name to bind to all interfaces
|
| 291 |
+
print("Retrying with server_name='0.0.0.0'")
|
| 292 |
+
app.launch(share=True, debug=True, server_name="0.0.0.0")
|
| 293 |
+
else:
|
| 294 |
+
raise e
|
| 295 |
except Exception as e:
|
| 296 |
print(f"Fatal error: {str(e)}")
|
| 297 |
# If all else fails, create a minimal app
|
| 298 |
with gr.Blocks() as minimal_app:
|
| 299 |
gr.Markdown("# AsianMOM: Fatal Error")
|
| 300 |
gr.Markdown(f"Fatal error: {str(e)}")
|
| 301 |
+
gr.Markdown("Try updating Gradio with: pip install --upgrade gradio")
|
| 302 |
+
try:
|
| 303 |
+
minimal_app.launch(share=True, server_name="0.0.0.0")
|
| 304 |
+
except:
|
| 305 |
+
minimal_app.launch(share=True) # Last attempt with minimal options
|