Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,13 +14,7 @@ from torch.nn.utils.parametrizations import weight_norm
|
|
14 |
|
15 |
login(token=os.environ["HF_TOKEN"])
|
16 |
|
17 |
-
|
18 |
device = torch.device("cpu")
|
19 |
-
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
|
20 |
-
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large").to("cpu")
|
21 |
-
pipe = StableAudioPipeline.from_pretrained("stabilityai/stable-audio-open-1.0")
|
22 |
-
pipe = pipe.to("cpu")
|
23 |
-
|
24 |
|
25 |
#img_url = 'https://www.caracteristicass.de/wp-content/uploads/2023/02/imagenes-artisticas.jpg'
|
26 |
|
@@ -38,6 +32,8 @@ with gr.Blocks(theme=gr.themes.Ocean(primary_hue="pink", neutral_hue="indigo", f
|
|
38 |
output2 = gr.Audio(label="Audio")
|
39 |
|
40 |
def describir(url):
|
|
|
|
|
41 |
raw_image = Image.open(requests.get(url, stream=True).raw).convert('RGB')
|
42 |
inputs = processor(raw_image, return_tensors="pt").to("cpu")
|
43 |
out = model.generate(**inputs)
|
@@ -45,6 +41,8 @@ with gr.Blocks(theme=gr.themes.Ocean(primary_hue="pink", neutral_hue="indigo", f
|
|
45 |
return leer(processor.decode(out[0], skip_special_tokens=True))
|
46 |
|
47 |
def leer(texto):
|
|
|
|
|
48 |
prompt = texto
|
49 |
negative_prompt = "Low quality."
|
50 |
|
|
|
14 |
|
15 |
login(token=os.environ["HF_TOKEN"])
|
16 |
|
|
|
17 |
device = torch.device("cpu")
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
#img_url = 'https://www.caracteristicass.de/wp-content/uploads/2023/02/imagenes-artisticas.jpg'
|
20 |
|
|
|
32 |
output2 = gr.Audio(label="Audio")
|
33 |
|
34 |
def describir(url):
|
35 |
+
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
|
36 |
+
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large").to("cpu")
|
37 |
raw_image = Image.open(requests.get(url, stream=True).raw).convert('RGB')
|
38 |
inputs = processor(raw_image, return_tensors="pt").to("cpu")
|
39 |
out = model.generate(**inputs)
|
|
|
41 |
return leer(processor.decode(out[0], skip_special_tokens=True))
|
42 |
|
43 |
def leer(texto):
|
44 |
+
pipe = StableAudioPipeline.from_pretrained("stabilityai/stable-audio-open-1.0")
|
45 |
+
pipe = pipe.to("cpu")
|
46 |
prompt = texto
|
47 |
negative_prompt = "Low quality."
|
48 |
|