Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from gradio_client import Client
|
| 3 |
+
|
| 4 |
+
def text_to_image(prompt):
|
| 5 |
+
client = Client("hysts/SDXL", headers={"x-ip-token": x_ip_token})
|
| 6 |
+
img = client.predict(prompt, api_name="/predict")
|
| 7 |
+
return img
|
| 8 |
+
|
| 9 |
+
def generate(prompt):
|
| 10 |
+
return text_to_image(prompt)
|
| 11 |
+
|
| 12 |
+
with gr.Blocks() as demo:
|
| 13 |
+
image = gr.Image()
|
| 14 |
+
prompt = gr.Textbox(max_lines=1)
|
| 15 |
+
prompt.submit(text_to_image, [prompt], [image])
|
| 16 |
+
|
| 17 |
+
demo.launch()
|