saburq commited on
Commit
f01b4da
β€’
1 Parent(s): 85e031f

use blocks api

Browse files
Files changed (1) hide show
  1. app.py +15 -10
app.py CHANGED
@@ -7,11 +7,11 @@ def generate_image_predictions(prompt):
7
  return images
8
 
9
 
10
- iface = gr.Blocks()
11
 
12
-
13
- iface = gr.Interface(
14
- """
15
  # 🌍 Map Diffuser
16
 
17
  🌏 Generates images from a given text prompt. The prompts are in the format:
@@ -34,10 +34,15 @@ iface = gr.Interface(
34
  | Watercolor style map of Amsterdam with residential area and highways | <img src="https://i.imgur.com/AQS34dk.png" width="300" /> |
35
  | Toner style map of Amsterdam with residential area and highways | <img src="https://i.imgur.com/X8VcezT.png" width="300" /> |
36
  | Satellite image with forests and residential, no water | <img src="https://i.imgur.com/MEccHdM.png" width="300" /> |
37
- """,
38
- fn=generate_image_predictions,
39
- inputs=gr.components.Textbox(label="Enter a text prompt here"),
40
- outputs=gr.components.Image(label="Output Image")
41
- )
 
 
 
 
 
42
 
43
- iface.launch()
 
7
  return images
8
 
9
 
10
+ demo = gr.Blocks()
11
 
12
+ with demo:
13
+ gr.Markdown(
14
+ """
15
  # 🌍 Map Diffuser
16
 
17
  🌏 Generates images from a given text prompt. The prompts are in the format:
 
34
  | Watercolor style map of Amsterdam with residential area and highways | <img src="https://i.imgur.com/AQS34dk.png" width="300" /> |
35
  | Toner style map of Amsterdam with residential area and highways | <img src="https://i.imgur.com/X8VcezT.png" width="300" /> |
36
  | Satellite image with forests and residential, no water | <img src="https://i.imgur.com/MEccHdM.png" width="300" /> |
37
+ """
38
+ )
39
+ input = gr.components.Textbox(label="Enter a text prompt here")
40
+ output = gr.components.Image(label="Output Image")
41
+ # button to submit the prompt
42
+ button = gr.components.Button(label="Generate")
43
+ # when the button is clicked, call the generate_image_predictions function
44
+ # and pass in the prompt as an argument
45
+ button.submit(generate_image_predictions, inputs=input, outputs=output)
46
+
47
 
48
+ demo.launch()