Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,8 @@
|
|
1 |
-
import
|
2 |
-
from transformers import pipeline
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
def generate_image(prompt):
|
8 |
-
result = pipe(prompt)[0] # Get the first generated image
|
9 |
-
return result
|
10 |
-
|
11 |
-
# Create the Gradio interface
|
12 |
-
demo = gr.Interface(
|
13 |
-
fn=generate_image,
|
14 |
-
inputs=gr.Textbox(lines=2, placeholder="Enter your prompt here..."),
|
15 |
-
outputs="image",
|
16 |
-
title="Text-to-Image Generator",
|
17 |
-
description="Powered by cloudqi/cqi_text_to_image_pt_v0"
|
18 |
)
|
|
|
19 |
|
20 |
-
# Run with public link enabled
|
21 |
-
demo.launch(share=True)
|
|
|
1 |
+
import requests
|
|
|
2 |
|
3 |
+
response = requests.post(
|
4 |
+
"https://cloudqi-cqi-text-to-image-pt-v0.hf.space/run/predict",
|
5 |
+
json={"data": ["A cat in space with sunglasses"]},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
)
|
7 |
+
image_url = response.json()["data"][0]
|
8 |
|
|
|
|