Spaces:
Running
on
Zero
Running
on
Zero
refactor: Simplify library imports and remove verbose version checks in `app_hf.py`.
Browse files
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🔍
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app_hf.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
|
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.1.0
|
| 8 |
app_file: app_hf.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
app_hf.py
CHANGED
|
@@ -1,20 +1,4 @@
|
|
| 1 |
-
import
|
| 2 |
-
import subprocess
|
| 3 |
-
|
| 4 |
-
try:
|
| 5 |
-
import gradio as gr
|
| 6 |
-
print(f"Gradio version: {gr.__version__}")
|
| 7 |
-
except ImportError:
|
| 8 |
-
print("Gradio not installed or failed to import")
|
| 9 |
-
# Attempt fallback or just fail
|
| 10 |
-
raise
|
| 11 |
-
|
| 12 |
-
try:
|
| 13 |
-
import huggingface_hub
|
| 14 |
-
print(f"HuggingFace Hub version: {huggingface_hub.__version__}")
|
| 15 |
-
except ImportError:
|
| 16 |
-
print("HuggingFace Hub not installed")
|
| 17 |
-
|
| 18 |
from transformers import AutoModel, AutoTokenizer, AutoProcessor, AutoModelForImageTextToText
|
| 19 |
import torch
|
| 20 |
import os
|
|
@@ -36,9 +20,7 @@ warnings.filterwarnings("ignore", message="You are using a model of type .* to i
|
|
| 36 |
# Try to import spaces, if not available (local run), create a dummy decorator
|
| 37 |
try:
|
| 38 |
import spaces
|
| 39 |
-
print(f"Spaces imported successfully")
|
| 40 |
except ImportError:
|
| 41 |
-
print("Spaces not found, using dummy decorator")
|
| 42 |
class spaces:
|
| 43 |
@staticmethod
|
| 44 |
def GPU(func):
|
|
|
|
| 1 |
+
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from transformers import AutoModel, AutoTokenizer, AutoProcessor, AutoModelForImageTextToText
|
| 3 |
import torch
|
| 4 |
import os
|
|
|
|
| 20 |
# Try to import spaces, if not available (local run), create a dummy decorator
|
| 21 |
try:
|
| 22 |
import spaces
|
|
|
|
| 23 |
except ImportError:
|
|
|
|
| 24 |
class spaces:
|
| 25 |
@staticmethod
|
| 26 |
def GPU(func):
|