Update app.py
Browse files
app.py
CHANGED
|
@@ -47,18 +47,19 @@ MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
|
| 47 |
|
| 48 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 49 |
|
| 50 |
-
#
|
| 51 |
def progress_bar_html(message: str) -> str:
|
| 52 |
return f"""
|
| 53 |
-
<div style="display: flex; align-items: center;">
|
| 54 |
-
<span style="margin-right:
|
| 55 |
-
<div style="position: relative; width:
|
| 56 |
-
<div style="position: absolute; width: 100%; height: 100%; background
|
| 57 |
</div>
|
| 58 |
</div>
|
| 59 |
<style>
|
| 60 |
@keyframes loading {{
|
| 61 |
0% {{ transform: translateX(-100%); }}
|
|
|
|
| 62 |
100% {{ transform: translateX(100%); }}
|
| 63 |
}}
|
| 64 |
</style>
|
|
@@ -79,7 +80,7 @@ TTS_VOICES = [
|
|
| 79 |
"en-US-GuyNeural", # @tts2
|
| 80 |
]
|
| 81 |
|
| 82 |
-
MODEL_ID = "prithivMLmods/Qwen2-VL-OCR-2B-Instruct"
|
| 83 |
processor = AutoProcessor.from_pretrained(MODEL_ID, trust_remote_code=True)
|
| 84 |
model_m = Qwen2VLForConditionalGeneration.from_pretrained(
|
| 85 |
MODEL_ID,
|
|
|
|
| 47 |
|
| 48 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 49 |
|
| 50 |
+
# Updated function with optimized progress UI
|
| 51 |
def progress_bar_html(message: str) -> str:
|
| 52 |
return f"""
|
| 53 |
+
<div style="display: flex; align-items: center; justify-content: center; margin: 10px 0;">
|
| 54 |
+
<span style="margin-right: 10px; font-weight: bold; color: #333;">{message}</span>
|
| 55 |
+
<div style="position: relative; width: 200px; height: 10px; background-color: #e0e0e0; border-radius: 5px; overflow: hidden;">
|
| 56 |
+
<div style="position: absolute; width: 100%; height: 100%; background: linear-gradient(90deg, #76c7c0, #4caf50); animation: loading 2s ease-in-out infinite;"></div>
|
| 57 |
</div>
|
| 58 |
</div>
|
| 59 |
<style>
|
| 60 |
@keyframes loading {{
|
| 61 |
0% {{ transform: translateX(-100%); }}
|
| 62 |
+
50% {{ transform: translateX(0%); }}
|
| 63 |
100% {{ transform: translateX(100%); }}
|
| 64 |
}}
|
| 65 |
</style>
|
|
|
|
| 80 |
"en-US-GuyNeural", # @tts2
|
| 81 |
]
|
| 82 |
|
| 83 |
+
MODEL_ID = "prithivMLmods/Qwen2-VL-OCR-2B-Instruct"
|
| 84 |
processor = AutoProcessor.from_pretrained(MODEL_ID, trust_remote_code=True)
|
| 85 |
model_m = Qwen2VLForConditionalGeneration.from_pretrained(
|
| 86 |
MODEL_ID,
|