Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from share_btn import community_icon_html, loading_icon_html, share_js
|
| 2 |
|
| 3 |
import os, subprocess
|
|
|
|
| 4 |
import torch
|
| 5 |
|
| 6 |
def setup():
|
|
@@ -35,7 +36,7 @@ sys.path.append('clip-interrogator')
|
|
| 35 |
import gradio as gr
|
| 36 |
from clip_interrogator import Config, Interrogator
|
| 37 |
|
| 38 |
-
config = Config()
|
| 39 |
config.device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 40 |
config.blip_offload = False if torch.cuda.is_available() else True
|
| 41 |
config.chunk_size = 2048
|
|
@@ -43,7 +44,7 @@ config.flavor_intermediate_count = 512
|
|
| 43 |
config.blip_num_beams = 64
|
| 44 |
ci = Interrogator(config)
|
| 45 |
|
| 46 |
-
|
| 47 |
def inference(image, mode, best_max_flavors):
|
| 48 |
|
| 49 |
|
|
|
|
| 1 |
from share_btn import community_icon_html, loading_icon_html, share_js
|
| 2 |
|
| 3 |
import os, subprocess
|
| 4 |
+
import spaces
|
| 5 |
import torch
|
| 6 |
|
| 7 |
def setup():
|
|
|
|
| 36 |
import gradio as gr
|
| 37 |
from clip_interrogator import Config, Interrogator
|
| 38 |
|
| 39 |
+
config = Config(download_cache=True)
|
| 40 |
config.device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 41 |
config.blip_offload = False if torch.cuda.is_available() else True
|
| 42 |
config.chunk_size = 2048
|
|
|
|
| 44 |
config.blip_num_beams = 64
|
| 45 |
ci = Interrogator(config)
|
| 46 |
|
| 47 |
+
@spaces.GPU
|
| 48 |
def inference(image, mode, best_max_flavors):
|
| 49 |
|
| 50 |
|