artificialguybr commited on
Commit
059cfb9
1 Parent(s): ab14713

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -21
app.py CHANGED
@@ -30,30 +30,35 @@ def run_lora(prompt, weight):
30
  return Image.open(image_bytes)
31
 
32
  # Gradio UI
33
- print("Before Gradio Blocks")
34
- with gr.Blocks(css="custom.css") as demo:
35
- print("Inside Gradio Blocks")
36
- title = gr.HTML(
37
- """<h1><img src="https://i.imgur.com/vT48NAO.png" alt="LoRA"> LoRA the Explorer</h1>""",
38
- elem_id="title",
39
- )
40
- gallery = gr.Gallery(
41
- value=[(item["image"], item["title"]) for item in loras],
42
- label="LoRA Gallery",
43
- allow_preview=False,
44
- columns=3,
45
- elem_id="gallery",
46
- show_share_button=False
47
- )
48
- prompt = gr.Textbox(label="Prompt", show_label=False, lines=1, max_lines=1, placeholder="Type a prompt after selecting a LoRA", elem_id="prompt")
49
- advanced_options = gr.Accordion("Advanced options", open=False)
50
- weight = gr.Slider(0, 10, value=1, step=0.1, label="LoRA weight")
51
- result = gr.Image(interactive=False, label="Generated Image", elem_id="result-image")
52
-
53
  print("Before Gradio Interface")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  gr.Interface(
55
  fn=run_lora,
56
- inputs=[prompt, weight],
57
  outputs=[result],
 
58
  ).launch()
 
59
  print("After Gradio Interface")
 
30
  return Image.open(image_bytes)
31
 
32
  # Gradio UI
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  print("Before Gradio Interface")
34
+
35
+ title = gr.HTML(
36
+ """<h1>LoRA the Explorer</h1>""",
37
+ elem_id="title",
38
+ )
39
+
40
+ gallery = gr.Gallery(
41
+ value=[(item["image"], item["title"]) for item in loras],
42
+ label="LoRA Gallery",
43
+ allow_preview=False,
44
+ columns=3,
45
+ elem_id="gallery",
46
+ show_share_button=False
47
+ )
48
+
49
+ prompt = gr.Textbox(label="Prompt", show_label=False, lines=1, max_lines=1, placeholder="Type a prompt after selecting a LoRA", elem_id="prompt")
50
+
51
+ advanced_options = gr.Accordion("Advanced options", open=False)
52
+
53
+ weight = gr.Slider(0, 10, value=1, step=0.1, label="LoRA weight")
54
+
55
+ result = gr.Image(interactive=False, label="Generated Image", elem_id="result-image")
56
+
57
  gr.Interface(
58
  fn=run_lora,
59
+ inputs=[title, gallery, prompt, advanced_options, weight],
60
  outputs=[result],
61
+ css="custom.css" # Make sure your custom CSS file is in the same directory
62
  ).launch()
63
+
64
  print("After Gradio Interface")