ImagineAI-Real's picture
Update app.py
b61216e
raw
history blame
1.04 kB
import gradio as gr
import requests
import base64
from PIL import Image
import io
def generate_image(prompt):
url = "https://d0d2ae5d-c88f-4283-ac3e-cc20cf66bfaa.id.repl.co/generate_image?prompt="+prompt
response = requests.get(url)
data = response.json()
base64_image = data["image"]
# Decode the base64 image data
image_data = base64.b64decode(base64_image)
image = Image.open(io.BytesIO(image_data))
return image
iface = gr.Interface(
fn=generate_image,
inputs="text",
outputs="image",
title="Midjourney2.0",
description="Anything Possible<br><h3>Currently only on Discord: <a href='https://discord.gg/d6wR8u6wnA'>https://discord.gg/d6wR8u6wnA</a></h3>",
allow_flagging=False,
layout="horizontal",
theme="default",
# examples=[
# "burger",
# "really cute cat emoji, white background, blue eyes, black fur, white top fur, pink inner ears",
# "Minecraft: \"House\"",
# "Cat with speech bubble, saying \"Hi\""
# ]
)
iface.launch()