Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,8 @@ import logging
|
|
9 |
import time
|
10 |
import uuid
|
11 |
import soundfile as sf
|
|
|
|
|
12 |
# model.py apache license 2.0 Copyright 2022-2023 Xiaomi Corp. (authors: Fangjun Kuang)
|
13 |
from model import get_pretrained_model, language_to_models
|
14 |
# demo for a input given image transform into text interpretation, and those text put a speech text to be played
|
@@ -63,16 +65,14 @@ def text_to_speech(language: str, repo_id: str, text: str, sid: str, speed: floa
|
|
63 |
|
64 |
return filename, build_html_output(info)
|
65 |
|
66 |
-
demo = gr.Blocks()
|
67 |
|
68 |
-
with demo:
|
69 |
language_choices = list(language_to_models.keys())
|
70 |
-
inputsImg=gr.Image(type='
|
71 |
idx=0
|
72 |
-
text_output = image_to_text_model(inputsImg)
|
73 |
-
|
74 |
print(text_output)
|
75 |
-
for txt in
|
76 |
output_txt[idx] = gr.Textbox(label=text_output,lines=1,max_lines=1,value=text_output,placeholder="Interpretation")
|
77 |
input_sid = gr.Textbox(
|
78 |
label="Speaker ID",
|
|
|
9 |
import time
|
10 |
import uuid
|
11 |
import soundfile as sf
|
12 |
+
from PIL import Image
|
13 |
+
|
14 |
# model.py apache license 2.0 Copyright 2022-2023 Xiaomi Corp. (authors: Fangjun Kuang)
|
15 |
from model import get_pretrained_model, language_to_models
|
16 |
# demo for a input given image transform into text interpretation, and those text put a speech text to be played
|
|
|
65 |
|
66 |
return filename, build_html_output(info)
|
67 |
|
|
|
68 |
|
69 |
+
with gr.Blocks() as demo:
|
70 |
language_choices = list(language_to_models.keys())
|
71 |
+
inputsImg=gr.Image(type='PIL')
|
72 |
idx=0
|
73 |
+
text_output = image_to_text_model(inputsImg)[0]
|
|
|
74 |
print(text_output)
|
75 |
+
for txt in t ext_output:
|
76 |
output_txt[idx] = gr.Textbox(label=text_output,lines=1,max_lines=1,value=text_output,placeholder="Interpretation")
|
77 |
input_sid = gr.Textbox(
|
78 |
label="Speaker ID",
|