Update app.py
Browse files
app.py
CHANGED
|
@@ -1,30 +1,28 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from diffusers import StableDiffusionImg2ImgPipeline
|
| 3 |
import torch
|
| 4 |
-
from
|
|
|
|
| 5 |
|
| 6 |
-
# Load
|
| 7 |
-
pipe =
|
| 8 |
-
"
|
| 9 |
-
torch_dtype=torch.float16
|
| 10 |
-
|
|
|
|
| 11 |
)
|
| 12 |
-
pipe = pipe.to("cuda"
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
def generate_thumbnail(prompt
|
| 16 |
-
image =
|
| 17 |
-
|
| 18 |
-
return result.images[0]
|
| 19 |
|
| 20 |
# Gradio UI
|
| 21 |
-
gr.Interface(
|
| 22 |
fn=generate_thumbnail,
|
| 23 |
-
inputs=
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
).launch()
|
|
|
|
|
|
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from diffusers import StableDiffusionPipeline
|
| 3 |
+
import gradio as gr
|
| 4 |
|
| 5 |
+
# Model Load करो
|
| 6 |
+
pipe = StableDiffusionPipeline.from_pretrained(
|
| 7 |
+
"Linaqruf/anything-v3.0",
|
| 8 |
+
torch_dtype=torch.float16,
|
| 9 |
+
revision="fp16",
|
| 10 |
+
safety_checker=None
|
| 11 |
)
|
| 12 |
+
pipe = pipe.to("cuda")
|
| 13 |
|
| 14 |
+
# Thumbnail generate करने वाला function
|
| 15 |
+
def generate_thumbnail(prompt):
|
| 16 |
+
image = pipe(prompt).images[0]
|
| 17 |
+
return image
|
|
|
|
| 18 |
|
| 19 |
# Gradio UI
|
| 20 |
+
interface = gr.Interface(
|
| 21 |
fn=generate_thumbnail,
|
| 22 |
+
inputs=gr.Textbox(label="Enter Prompt", placeholder="e.g. Minecraft thumbnail, anime character"),
|
| 23 |
+
outputs=gr.Image(type="pil", label="Generated Thumbnail"),
|
| 24 |
+
title="Thumbnail Generator (Anime Style)",
|
| 25 |
+
description="Enter your prompt to generate an anime-style thumbnail using Anything-v3.0"
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
interface.launch()
|
|
|