Spaces:
Sleeping
Sleeping
import gradio as gr | |
from inference_code import generate_images | |
def generate_image_predictions(prompt): | |
images = generate_images(prompt) | |
return images | |
demo = gr.Blocks() | |
with demo: | |
gr.Markdown( | |
""" | |
# 🌍 Map Diffuser | |
### Generates images from a given text prompt. The prompts are in the format: | |
- `{style} map of {city} with {features}` or | |
- `satellite image of {city} with {features}` or | |
- `satellite image with {features}` or | |
- `satellite image of {city} with {features} and no {features}` | |
and so on... | |
### So for example: | |
- "Satellite image of amsterdam with industrial area and highways" | |
- "Watercolor style map of Amsterdam with residential area and highways" | |
- "Toner style map of Amsterdam with residential area and highways" | |
- "Satellite image with forests and residential, no water" | |
Examples table: | |
| Prompt | Output | | |
| --- | --- | | |
| Satellite image of industrial area with ships | <img src="https://www.evernote.com/shard/s542/sh/61ee9b28-14a4-471b-89c1-beceeaa5c3b7/U6r8RasxpAtG4lffwKc7VdZn67b8O5w85zyFcKGH6yObMrD2ArITfJV77A/deep/0/image.png" width="100" /> | | |
| Watercolor style map of Amsterdam with residential area and highways | <img src="https://www.evernote.com/shard/s542/sh/a22970f5-552f-4872-b738-667e64b28be4/ecjvm3GJBekvShqyebx8RQYH1ZTP4WrZzSqhB5lt6kv5jUjgKH0l7b57KA/deep/0/image.png" width="100" /> | | |
| Toner style map of Amsterdam with residential area and highways | <img src="https://www.evernote.com/shard/s542/sh/1dfce0dc-8d63-4a83-b590-979ad038198f/1N9mAOsR0GddsULJaAMB8dYU9eR1-McyUXtgOmVFQ4UbX0rwbNfkylI1iQ/deep/0/image.png" width="100" /> | | |
| Satellite image with forests and residential, no water | <img src="https://www.evernote.com/shard/s542/sh/2c532cf5-e73b-410e-8433-439466211306/Fh8SsltsWRCW_bLGmrj_TfV2vfEwTUbDiUz_bMSn__0EuzmhdTK5F-C1og/deep/0/image.png" width="300" /> | | |
""" | |
) | |
input = gr.components.Textbox(label="Enter a text prompt here") | |
output = gr.components.Image(label="Output Image") | |
# button to submit the prompt | |
button = gr.components.Button(label="Generate") | |
# when the button is clicked, call the generate_image_predictions function | |
# and pass in the prompt as an argument | |
button.click(generate_image_predictions, inputs=input, outputs=output) | |
demo.launch() | |