Update app.py
Browse files
app.py
CHANGED
@@ -1,43 +1,43 @@
|
|
1 |
import numpy as np
|
2 |
import gradio as gr
|
3 |
|
4 |
-
def flip_text(x):
|
5 |
-
return x[::-1]
|
6 |
|
7 |
-
def
|
8 |
-
return
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
with
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
text_button
|
27 |
-
|
28 |
-
with
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
audio_text_output =
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
1 |
import numpy as np
|
2 |
import gradio as gr
|
3 |
|
|
|
|
|
4 |
|
5 |
+
def textMode(text, count):
|
6 |
+
return "In progress"
|
7 |
+
|
8 |
+
|
9 |
+
def imageMode(image, question):
|
10 |
+
return "In progress"
|
11 |
+
|
12 |
+
def audioMode(audio):
|
13 |
+
return "In progress"
|
14 |
+
|
15 |
+
|
16 |
+
interface_title = "TSAI-ERA-V1 - Capstone - Multimodal GPT Demo"
|
17 |
+
with gr.Blocks() as demo:
|
18 |
+
with gr.Row():
|
19 |
+
gr.Markdown(f"<h1>{interface_title}</h1>", element_id="title")
|
20 |
+
gr.Markdown("Choose text mode/image mode/audio mode for generation")
|
21 |
+
with gr.Tab("Text mode"):
|
22 |
+
text_input = gr.Textbox(placeholder="Enter a prompt", label="Input")
|
23 |
+
text_input_count = gr.Textbox(placeholder="Enter number of characters you want to generate", label="Count")
|
24 |
+
text_button = gr.Button("Submit")
|
25 |
+
text_output = gr.Textbox(label="Chat GPT like text")
|
26 |
+
with gr.Tab("Image mode"):
|
27 |
+
with gr.Row():
|
28 |
+
image_input = gr.Image()
|
29 |
+
image_text_input = gr.Textbox(placeholder="Enter a question/prompt around the image", label="Question/Prompt")
|
30 |
+
image_button = gr.Button("Submit")
|
31 |
+
image_text_output = gr.Textbox(label="Answer")
|
32 |
+
|
33 |
+
with gr.Tab("Audio mode"):
|
34 |
+
audio_input = gr.Audio()
|
35 |
+
audio_button = gr.Button("Submit")
|
36 |
+
audio_text_output = gr.Textbox(label="Chat GPT like text")
|
37 |
+
|
38 |
+
|
39 |
+
text_button.click(textMode, inputs=[text_input, text_input_count], outputs=text_output)
|
40 |
+
image_button.click(imageMode, inputs=[image_input,image_text_input], outputs=image_text_output)
|
41 |
+
audio_button.click(audioMode, inputs=audio_input, outputs=audio_text_output)
|
42 |
+
|
43 |
+
demo.launch()
|