|
|
import gradio as gr |
|
|
from fooocus import FooocusProcessor |
|
|
|
|
|
import os |
|
|
print(os.listdir('.')) |
|
|
|
|
|
|
|
|
|
|
|
fooocus_processor = FooocusProcessor(model_path="path_to_model") |
|
|
|
|
|
def process_with_fooocus(prompt, steps, guidance_scale): |
|
|
""" |
|
|
Generate an image using Fooocus based on user input. |
|
|
""" |
|
|
try: |
|
|
result_image = fooocus_processor.generate( |
|
|
prompt=prompt, |
|
|
steps=steps, |
|
|
guidance_scale=guidance_scale |
|
|
) |
|
|
return result_image |
|
|
except Exception as e: |
|
|
return f"An error occurred: {e}" |
|
|
|
|
|
iface = gr.Interface( |
|
|
fn=process_with_fooocus, |
|
|
inputs=[ |
|
|
gr.Textbox(lines=2, placeholder="Enter your prompt here", label="Prompt"), |
|
|
gr.Slider(1, 100, step=1, value=50, label="Steps"), |
|
|
gr.Slider(1.0, 20.0, step=0.5, value=7.5, label="Guidance Scale"), |
|
|
], |
|
|
outputs=gr.Image(label="Generated Image"), |
|
|
title="Fooocus Image Generator", |
|
|
description="Generate high-quality images using Fooocus and Gradio." |
|
|
) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
iface.launch() |
|
|
|