Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -32,7 +32,6 @@ with gr.Blocks(theme=gr.themes.Ocean(primary_hue="pink", neutral_hue="indigo", f
|
|
32 |
textbox = gr.Textbox(label="Url")
|
33 |
with gr.Row():
|
34 |
button = gr.Button("Intro", variant="primary")
|
35 |
-
button2 = gr.Button("Leer", variant="primary")
|
36 |
clear = gr.Button("Borrar")
|
37 |
output = gr.Textbox(label="Resumen")
|
38 |
output2 = gr.Audio(label="Audio")
|
@@ -41,7 +40,7 @@ with gr.Blocks(theme=gr.themes.Ocean(primary_hue="pink", neutral_hue="indigo", f
|
|
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)
|
44 |
-
return processor.decode(out[0], skip_special_tokens=True)
|
45 |
|
46 |
def leer(texto):
|
47 |
prompt = texto
|
@@ -64,7 +63,6 @@ with gr.Blocks(theme=gr.themes.Ocean(primary_hue="pink", neutral_hue="indigo", f
|
|
64 |
return audio[0].T.float().cpu().numpy()
|
65 |
|
66 |
|
67 |
-
button.click(describir, [textbox],
|
68 |
-
button.click(leer, [output], output2)
|
69 |
|
70 |
demo.launch(debug=True)
|
|
|
32 |
textbox = gr.Textbox(label="Url")
|
33 |
with gr.Row():
|
34 |
button = gr.Button("Intro", variant="primary")
|
|
|
35 |
clear = gr.Button("Borrar")
|
36 |
output = gr.Textbox(label="Resumen")
|
37 |
output2 = gr.Audio(label="Audio")
|
|
|
40 |
raw_image = Image.open(requests.get(url, stream=True).raw).convert('RGB')
|
41 |
inputs = processor(raw_image, return_tensors="pt").to("cpu")
|
42 |
out = model.generate(**inputs)
|
43 |
+
return leer(processor.decode(out[0], skip_special_tokens=True))
|
44 |
|
45 |
def leer(texto):
|
46 |
prompt = texto
|
|
|
63 |
return audio[0].T.float().cpu().numpy()
|
64 |
|
65 |
|
66 |
+
button.click(describir, [textbox], output2)
|
|
|
67 |
|
68 |
demo.launch(debug=True)
|