Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,9 +18,7 @@ class Aspecto():
|
|
| 18 |
|
| 19 |
screen = Aspecto()
|
| 20 |
with gr.Blocks(theme=gr.themes.Ocean(primary_hue="pink", neutral_hue="indigo", font=[gr.themes.GoogleFont("Montserrat"), "Playwrite England SemiJoine", "Quicksand"])) as demo:
|
| 21 |
-
textbox = gr.Textbox(label="Url")
|
| 22 |
image = gr.Image(label="Imagen", sources = ["upload","clipboard"])
|
| 23 |
-
button3 = gr.Button("Mostrar", variant="primary")
|
| 24 |
with gr.Row():
|
| 25 |
button = gr.Button("Describir", variant="primary")
|
| 26 |
clear = gr.Button("Borrar")
|
|
@@ -30,8 +28,8 @@ with gr.Blocks(theme=gr.themes.Ocean(primary_hue="pink", neutral_hue="indigo", f
|
|
| 30 |
clear = gr.Button("Borrar")
|
| 31 |
output2 = gr.Audio(label="Audio")
|
| 32 |
|
| 33 |
-
def describir(
|
| 34 |
-
raw_image =
|
| 35 |
inputs = processor(raw_image, return_tensors="pt").to("cpu")
|
| 36 |
out = model.generate(**inputs)
|
| 37 |
return processor.decode(out[0], skip_special_tokens=True)
|
|
@@ -56,14 +54,9 @@ with gr.Blocks(theme=gr.themes.Ocean(primary_hue="pink", neutral_hue="indigo", f
|
|
| 56 |
temp_audio_path = temp_audio_file.name
|
| 57 |
|
| 58 |
return temp_audio_path
|
| 59 |
-
|
| 60 |
-
def loadimage(url):
|
| 61 |
-
image_url = url
|
| 62 |
-
return image_url
|
| 63 |
|
| 64 |
|
| 65 |
button.click(describir, [textbox], output)
|
| 66 |
button2.click(leer, [output], output2)
|
| 67 |
-
button3.click(loadimage, [textbox],image)
|
| 68 |
|
| 69 |
demo.launch(debug=True)
|
|
|
|
| 18 |
|
| 19 |
screen = Aspecto()
|
| 20 |
with gr.Blocks(theme=gr.themes.Ocean(primary_hue="pink", neutral_hue="indigo", font=[gr.themes.GoogleFont("Montserrat"), "Playwrite England SemiJoine", "Quicksand"])) as demo:
|
|
|
|
| 21 |
image = gr.Image(label="Imagen", sources = ["upload","clipboard"])
|
|
|
|
| 22 |
with gr.Row():
|
| 23 |
button = gr.Button("Describir", variant="primary")
|
| 24 |
clear = gr.Button("Borrar")
|
|
|
|
| 28 |
clear = gr.Button("Borrar")
|
| 29 |
output2 = gr.Audio(label="Audio")
|
| 30 |
|
| 31 |
+
def describir(image):
|
| 32 |
+
raw_image = image
|
| 33 |
inputs = processor(raw_image, return_tensors="pt").to("cpu")
|
| 34 |
out = model.generate(**inputs)
|
| 35 |
return processor.decode(out[0], skip_special_tokens=True)
|
|
|
|
| 54 |
temp_audio_path = temp_audio_file.name
|
| 55 |
|
| 56 |
return temp_audio_path
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
|
| 59 |
button.click(describir, [textbox], output)
|
| 60 |
button2.click(leer, [output], output2)
|
|
|
|
| 61 |
|
| 62 |
demo.launch(debug=True)
|