Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from synthscope import GoogleSearchImageGen
|
| 3 |
+
|
| 4 |
+
with gr.Blocks(theme=gr.themes.Default(primary_hue="teal", secondary_hue="amber"),
|
| 5 |
+
css="footer {display: none !important;}") as app:
|
| 6 |
+
gr.HTML("<div style='text-align:center;overflow:hidden;'><h2>🌐 SynthScope 🎨</h2></div>")
|
| 7 |
+
|
| 8 |
+
with gr.Column():
|
| 9 |
+
with gr.Row():
|
| 10 |
+
with gr.Column(scale=1):
|
| 11 |
+
gr.Markdown("<h4>Google Search Result</h4>")
|
| 12 |
+
text_output = gr.Markdown(height=300)
|
| 13 |
+
with gr.Column(scale=1):
|
| 14 |
+
gr.Markdown("<h4>Search Result Image</h4>")
|
| 15 |
+
image_output = gr.Image(label="", show_label=False,height=300)
|
| 16 |
+
|
| 17 |
+
with gr.Column():
|
| 18 |
+
with gr.Row():
|
| 19 |
+
text_input = gr.Textbox(label="Query Field", placeholder="Type in your search query")
|
| 20 |
+
radio_input = gr.Radio(label="Select Search Result Image Style", choices=["Comic", "Cartoon", "3D", "Anime", "Ghibli", "Victorian"])
|
| 21 |
+
|
| 22 |
+
with gr.Row():
|
| 23 |
+
btn = gr.Button("Run SynthScope")
|
| 24 |
+
clear_btn = gr.ClearButton([text_input, radio_input, text_output, image_output], value="Clear")
|
| 25 |
+
|
| 26 |
+
btn.click(fn=GoogleSearchImageGen, inputs=[text_input, radio_input], outputs=[text_output, image_output])
|
| 27 |
+
|
| 28 |
+
if __name__ == "__main__":
|
| 29 |
+
app.launch()
|