Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,33 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import torch
|
| 3 |
-
from diffusers import AutoPipelineForText2Image
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
DEVICE = "cpu"
|
| 8 |
-
|
| 9 |
-
pipe = AutoPipelineForText2Image.from_pretrained(
|
| 10 |
-
MODEL_ID,
|
| 11 |
-
torch_dtype=torch.float32,
|
| 12 |
-
)
|
| 13 |
-
pipe.to(DEVICE)
|
| 14 |
-
|
| 15 |
-
def generate_image(prompt: str):
|
| 16 |
-
if not prompt.strip():
|
| 17 |
-
return None
|
| 18 |
-
result = pipe(
|
| 19 |
-
prompt,
|
| 20 |
-
num_inference_steps=4, # Fast rendering
|
| 21 |
-
guidance_scale=0.0, # More realistic, less overexposed
|
| 22 |
-
)
|
| 23 |
-
return result.images[0]
|
| 24 |
|
| 25 |
demo = gr.Interface(
|
| 26 |
-
fn=
|
| 27 |
-
inputs=
|
| 28 |
-
outputs=
|
| 29 |
-
title="Freeverse AI
|
| 30 |
-
description="Generate ultra-realistic AI images using Stable Diffusion Turbo (Freeverse AI).",
|
| 31 |
)
|
| 32 |
|
| 33 |
if __name__ == "__main__":
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
def test_fn(text):
|
| 4 |
+
return "Freeverse AI is working: " + text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
demo = gr.Interface(
|
| 7 |
+
fn=test_fn,
|
| 8 |
+
inputs="text",
|
| 9 |
+
outputs="text",
|
| 10 |
+
title="Freeverse AI Test"
|
|
|
|
| 11 |
)
|
| 12 |
|
| 13 |
if __name__ == "__main__":
|