angtrim commited on
Commit
fb624fd
1 Parent(s): fcad6de

nuova interfaccia

Browse files
Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -1,7 +1,20 @@
1
  import gradio as gr
 
 
 
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import torch
3
+ import numpy as np
4
+ import modin.pandas as pd
5
+ from PIL import Image
6
+ from diffusers import DiffusionPipeline
7
 
8
+ device = "cuda" if torch.cuda.is_available() else "cpu"
 
9
 
10
+ pipe = DiffusionPipeline.from_pretrained("krnl/venereital-IA-23", safety_checker=None)
11
+ pipe = pipe.to(device)
12
+
13
+ def genie (prompt, negative_prompt, scale, steps, seed):
14
+ generator = torch.Generator(device=device).manual_seed(seed)
15
+ prompt = "photo of sks person, " + prompt
16
+ negative_prompt = "nude, naked, tits, nsfw, " + negative_prompt
17
+ images = pipe(prompt, negative_prompt=negative_prompt, width=512, height=512, num_inference_steps=steps, guidance_scale=scale, num_images_per_prompt=1, generator=generator).images[0]
18
+ return images
19
+
20
+ gr.Interface(fn=genie, inputs=[gr.Textbox(label='Descrivi la tua venere ideale',default="capelli rossi, con occhiali da sole"), gr.Textbox(label='Descrivi cosa non vorresti vedere',default="faccia triste")], outputs='image', title="Generatore di Venere", description="Genera la tua Venere! Scatena la tua fantsIA!").launch(debug=True, max_threads=True)