gremlin97 commited on
Commit
922ebfc
·
1 Parent(s): dd9a2b3

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +2 -8
  2. app.py +59 -0
  3. requirements.txt +3 -0
README.md CHANGED
@@ -1,12 +1,6 @@
1
  ---
2
- title: Remote Diffusion
3
- emoji: 📚
4
- colorFrom: pink
5
- colorTo: yellow
6
  sdk: gradio
7
  sdk_version: 4.11.0
8
- app_file: app.py
9
- pinned: false
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Remote_Diffusion
3
+ app_file: app.py
 
 
4
  sdk: gradio
5
  sdk_version: 4.11.0
 
 
6
  ---
 
 
app.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from diffusers import StableDiffusionPipeline
4
+
5
+ import torch
6
+
7
+ from PIL import Image
8
+
9
+
10
+
11
+ # Load the model
12
+
13
+ model_path = "gremlin97/RemoteDiff224"
14
+
15
+ pipe = StableDiffusionPipeline.from_pretrained(model_path, torch_dtype=torch.float16)
16
+
17
+ pipe.to("cuda")
18
+
19
+
20
+
21
+ # Fixed negative prompt
22
+
23
+ fixed_negative_prompt = "weird colors, low quality, jpeg artifacts, lowres, grainy, deformed structures, blurry, opaque, low contrast, distorted details, details are low"
24
+
25
+
26
+
27
+ # Function to generate images based on input text
28
+
29
+ def generate_image(prompt):
30
+
31
+ image = pipe(prompt=prompt, negative_prompt=fixed_negative_prompt, num_inference_steps=100, guidance_scale=7.5).images[0]
32
+
33
+ return image
34
+
35
+
36
+
37
+ # Create a Gradio interface with a submit button
38
+
39
+ iface = gr.Interface(
40
+
41
+ fn=generate_image,
42
+
43
+ inputs="text",
44
+
45
+ outputs=gr.Image(), # Initial placeholder for the image,
46
+
47
+ title="RemoteDiff224 Image Generator",
48
+
49
+ description="Generate images based on input prompts with a fixed negative prompt.",
50
+
51
+ )
52
+
53
+
54
+
55
+ # Launch the Gradio interface
56
+
57
+ iface.launch(share=True)
58
+
59
+
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ diffusers
3
+ accelerate