hoh2000 commited on
Commit
0e4ed3d
·
verified ·
1 Parent(s): 8281fbe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -18
app.py CHANGED
@@ -1,21 +1,8 @@
1
- import gradio as gr
2
- from transformers import pipeline
3
 
4
- # Load the model with remote code
5
- pipe = pipeline("text-to-image", model="cloudqi/cqi_text_to_image_pt_v0", trust_remote_code=True)
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