Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,7 @@ import logging
|
|
| 9 |
import re
|
| 10 |
import torch
|
| 11 |
import gradio as gr
|
|
|
|
| 12 |
|
| 13 |
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
|
| 14 |
|
|
@@ -47,7 +48,8 @@ class PromptEnhancerV2:
|
|
| 47 |
)
|
| 48 |
self.processor = AutoProcessor.from_pretrained(models_root_path)
|
| 49 |
|
| 50 |
-
@torch.inference_mode()
|
|
|
|
| 51 |
def predict(
|
| 52 |
self,
|
| 53 |
prompt_cot,
|
|
@@ -111,7 +113,8 @@ class PromptEnhancerV2:
|
|
| 111 |
print(f"✗ Re-prompting failed, so we are using the original prompt. Error: {e}")
|
| 112 |
|
| 113 |
return prompt_cot
|
| 114 |
-
@torch.inference_mode()
|
|
|
|
| 115 |
def predict_stream(
|
| 116 |
self,
|
| 117 |
prompt_cot,
|
|
|
|
| 9 |
import re
|
| 10 |
import torch
|
| 11 |
import gradio as gr
|
| 12 |
+
import spaces
|
| 13 |
|
| 14 |
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
|
| 15 |
|
|
|
|
| 48 |
)
|
| 49 |
self.processor = AutoProcessor.from_pretrained(models_root_path)
|
| 50 |
|
| 51 |
+
# @torch.inference_mode()
|
| 52 |
+
@spaces.GPU
|
| 53 |
def predict(
|
| 54 |
self,
|
| 55 |
prompt_cot,
|
|
|
|
| 113 |
print(f"✗ Re-prompting failed, so we are using the original prompt. Error: {e}")
|
| 114 |
|
| 115 |
return prompt_cot
|
| 116 |
+
# @torch.inference_mode()
|
| 117 |
+
@spaces.GPU
|
| 118 |
def predict_stream(
|
| 119 |
self,
|
| 120 |
prompt_cot,
|