Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,10 +10,8 @@ import os
|
|
10 |
os.environ['CUDA_VISIBLE_DEVICES'] = ''
|
11 |
|
12 |
device = torch.device("cpu")
|
13 |
-
model = SomeModel()
|
14 |
-
model = model.to(device)
|
15 |
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
|
16 |
-
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large").to("
|
17 |
pipe = StableAudioPipeline.from_pretrained("stabilityai/stable-audio-open-1.0", torch_dtype=torch.float16)
|
18 |
pipe = pipe.to("cpu")
|
19 |
|
@@ -36,7 +34,7 @@ with gr.Blocks(theme=gr.themes.Ocean(primary_hue="pink", neutral_hue="indigo", f
|
|
36 |
|
37 |
def describir(url):
|
38 |
raw_image = Image.open(requests.get(url, stream=True).raw).convert('RGB')
|
39 |
-
inputs = processor(raw_image, return_tensors="pt").to("
|
40 |
out = model.generate(**inputs)
|
41 |
return processor.decode(out[0], skip_special_tokens=True)
|
42 |
|
@@ -45,7 +43,7 @@ with gr.Blocks(theme=gr.themes.Ocean(primary_hue="pink", neutral_hue="indigo", f
|
|
45 |
negative_prompt = "Low quality."
|
46 |
|
47 |
# set the seed for generator
|
48 |
-
generator = torch.Generator("
|
49 |
|
50 |
# run the generation
|
51 |
audio = pipe(
|
|
|
10 |
os.environ['CUDA_VISIBLE_DEVICES'] = ''
|
11 |
|
12 |
device = torch.device("cpu")
|
|
|
|
|
13 |
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
|
14 |
+
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large").to("cpu")
|
15 |
pipe = StableAudioPipeline.from_pretrained("stabilityai/stable-audio-open-1.0", torch_dtype=torch.float16)
|
16 |
pipe = pipe.to("cpu")
|
17 |
|
|
|
34 |
|
35 |
def describir(url):
|
36 |
raw_image = Image.open(requests.get(url, stream=True).raw).convert('RGB')
|
37 |
+
inputs = processor(raw_image, return_tensors="pt").to("cpu")
|
38 |
out = model.generate(**inputs)
|
39 |
return processor.decode(out[0], skip_special_tokens=True)
|
40 |
|
|
|
43 |
negative_prompt = "Low quality."
|
44 |
|
45 |
# set the seed for generator
|
46 |
+
generator = torch.Generator("cpu").manual_seed(0)
|
47 |
|
48 |
# run the generation
|
49 |
audio = pipe(
|