Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
df = pd.DataFrame({'x': [1,2,3], 'y': [4,5,6]})
|
| 4 |
+
|
| 5 |
+
def change_output(img):
|
| 6 |
+
if img == "Example1":
|
| 7 |
+
return "img1.png", "A man flying in the air with cars", "plot1.png", "regen1.png"
|
| 8 |
+
elif img == "Example3":
|
| 9 |
+
return "img2.jpg", "A man wearing sunglasses", "plot2.png", "regen2.png"
|
| 10 |
+
elif img == "Example2":
|
| 11 |
+
return "img3.png", "A group of people wearing suits", "plot3.png", "regen3.png"
|
| 12 |
+
|
| 13 |
+
with gr.Blocks() as demo:
|
| 14 |
+
inp = gr.Dropdown(["Example1", "Example2", "Example3"], value=["Example1"], label="Example Image")
|
| 15 |
+
|
| 16 |
+
org_img = gr.Image(value="img1.png", type="numpy", label="Stimulus", shape=(160, 90))
|
| 17 |
+
caption = gr.Label("A man flying in the air with cars", label="Caption")
|
| 18 |
+
# with gr.Row():
|
| 19 |
+
neural_plot = gr.Image(value="plot1.png", type="numpy", label="Neural Plot")
|
| 20 |
+
regen_img = gr.Image(value="regen1.png", type="numpy", label="Regenerated Image", shape=(160, 90))
|
| 21 |
+
|
| 22 |
+
inp.change(change_output, inp, [org_img, caption, regen_img, neural_plot])
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
demo.launch()
|