File size: 1,048 Bytes
922ebfc
 
 
 
 
 
 
 
 
 
 
 
 
 
9562214
922ebfc
 
 
 
 
 
 
 
 
 
 
4f9bf24
922ebfc
4f9bf24
922ebfc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55fc355
922ebfc
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import gradio as gr

from diffusers import StableDiffusionPipeline

import torch

from PIL import Image



# Load the model

model_path = "gremlin97/RemoteDiff224"

pipe = StableDiffusionPipeline.from_pretrained(model_path)



# Fixed negative prompt

fixed_negative_prompt = "weird colors, low quality, jpeg artifacts, lowres, grainy, deformed structures, blurry, opaque, low contrast, distorted details, details are low"


# Function to generate images based on input text

def generate_image(prompt):
    prompt += " , 8k, best quality, high-resolution"

    image = pipe(prompt=prompt, negative_prompt=fixed_negative_prompt, num_inference_steps=50, guidance_scale=7.5).images[0]

    return image



# Create a Gradio interface with a submit button

iface = gr.Interface(

    fn=generate_image,

    inputs="text",

    outputs=gr.Image(),  # Initial placeholder for the image,

    title="RemoteDiff224 Image Generator",

    description="Stable Diffusion for Remote Sensing!",

)



# Launch the Gradio interface

iface.launch(share=True)