Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
# URLs of the images
|
| 4 |
+
urls = [
|
| 5 |
+
"https://raw.githubusercontent.com/xoghd1126/G4-finalproject/main/wordcloud.png"
|
| 6 |
+
]
|
| 7 |
+
|
| 8 |
+
# Function to get the selected image URL
|
| 9 |
+
def get_image(sid):
|
| 10 |
+
nid = int(sid) - 1
|
| 11 |
+
return urls[nid]
|
| 12 |
+
|
| 13 |
+
# Create a Gradio interface
|
| 14 |
+
with gr.Blocks() as demo:
|
| 15 |
+
sid_input = gr.Radio(choices=["1", "2", "3", "4"], label="Select Image")
|
| 16 |
+
image_output = gr.Image()
|
| 17 |
+
|
| 18 |
+
sid_input.change(fn=get_image, inputs=sid_input, outputs=image_output)
|
| 19 |
+
|
| 20 |
+
demo.launch()
|