Update app.py
Browse files
app.py
CHANGED
|
@@ -24,4 +24,25 @@ iface = gr.Interface(
|
|
| 24 |
description="Generate thumbnails using Linaqruf/anything-v3.0 model"
|
| 25 |
)
|
| 26 |
|
| 27 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
description="Generate thumbnails using Linaqruf/anything-v3.0 model"
|
| 25 |
)
|
| 26 |
|
| 27 |
+
iface.launch()
|
| 28 |
+
|
| 29 |
+
from diffusers import StableDiffusionPipeline
|
| 30 |
+
import torch
|
| 31 |
+
import gradio as gr
|
| 32 |
+
|
| 33 |
+
pipe = StableDiffusionPipeline.from_pretrained(
|
| 34 |
+
"Linaqruf/anything-v3.0",
|
| 35 |
+
torch_dtype=torch.float16, # यह सिर्फ device-level पर effect करता है
|
| 36 |
+
use_auth_token=True
|
| 37 |
+
).to("cuda")
|
| 38 |
+
|
| 39 |
+
def generate(prompt):
|
| 40 |
+
image = pipe(prompt).images[0]
|
| 41 |
+
return image
|
| 42 |
+
|
| 43 |
+
gr.Interface(
|
| 44 |
+
fn=generate,
|
| 45 |
+
inputs=gr.Textbox(label="Prompt"),
|
| 46 |
+
outputs=gr.Image(type="pil"),
|
| 47 |
+
title="Anything-v3 Thumbnail Generator"
|
| 48 |
+
).launch()
|