Spaces:
Runtime error
Runtime error
ui update
Browse files
app.py
CHANGED
@@ -1,14 +1,33 @@
|
|
1 |
import gradio as gr
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
with gr.Blocks() as demo:
|
4 |
with gr.Row():
|
5 |
with gr.Column(scale=1, min_width=600):
|
6 |
text1 = gr.Textbox(label="Input Text")
|
|
|
7 |
text2 = gr.Textbox(label="prompt",interactive=False)
|
|
|
|
|
8 |
with gr.Row():
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
text5 = gr.Textbox(label="prompt After Tone",interactive=False)
|
13 |
-
|
14 |
-
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
def process(text1):
|
4 |
+
return "this is "+text1+" after prompted"
|
5 |
+
|
6 |
+
def happy_tone(text2):
|
7 |
+
return text2+" with Happy tone"
|
8 |
+
|
9 |
+
def sad_tone(text2):
|
10 |
+
return text2+" with Sad tone"
|
11 |
+
|
12 |
+
def excited_tone(text2):
|
13 |
+
return text2+" with Excited tone"
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
with gr.Blocks() as demo:
|
18 |
with gr.Row():
|
19 |
with gr.Column(scale=1, min_width=600):
|
20 |
text1 = gr.Textbox(label="Input Text")
|
21 |
+
process_btn = gr.Button("Process")
|
22 |
text2 = gr.Textbox(label="prompt",interactive=False)
|
23 |
+
process_btn.click(fn=process, inputs=text1, outputs=text2, api_name="process")
|
24 |
+
|
25 |
with gr.Row():
|
26 |
+
happy_btn = gr.Button("Happy")
|
27 |
+
sad_btn = gr.Button("Sad")
|
28 |
+
excited_btn = gr.Button("Excited")
|
29 |
text5 = gr.Textbox(label="prompt After Tone",interactive=False)
|
30 |
+
happy_btn.click(fn=happy_tone, inputs=text2, outputs=text5, api_name="happy_tone")
|
31 |
+
sad_btn.click(fn=sad_tone, inputs=text2, outputs=text5, api_name="sad_tone")
|
32 |
+
excited_btn.click(fn=excited_tone, inputs=text2, outputs=text5, api_name="excited_tone")
|
33 |
+
demo.launch()
|