Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,21 @@
|
|
| 1 |
-
from huggingface_hub import snapshot_download
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
|
| 7 |
-
def
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
-
|
| 11 |
-
demo.
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
prompt = "Gato em alta qualidade na neve\n"
|
| 18 |
-
image = pipe(prompt).images[0]
|
|
|
|
|
|
|
| 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)
|
|
|
|
|
|