Jonny001 commited on
Commit
a6c85e0
·
verified ·
1 Parent(s): 92444c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -7,18 +7,23 @@ models = {
7
  "Master": "models/pimpilikipilapi1/NSFW_master"
8
  }
9
 
10
-
11
  def generate_image(text, model_name):
12
  model_path = models[model_name]
13
- model = gr.load(model_path)
14
- result_image = model(text)
15
- return result_image
 
 
 
 
 
 
16
 
17
 
18
  interface = gr.Interface(
19
  fn=generate_image,
20
  inputs=[
21
- gr.Textbox(label="Type here your Honny imagination 😁:", placeholder="Type your description here..."),
22
  gr.Dropdown(label="Select Model", choices=list(models.keys()), value="Flux Lora")
23
  ],
24
  outputs=gr.Image(label="Generated Image"),
@@ -26,4 +31,5 @@ interface = gr.Interface(
26
  description="Sorry for the inconvenience. The model is currently running on the CPU, which might affect performance. We appreciate your understanding.",
27
  )
28
 
29
- interface.launch()
 
 
7
  "Master": "models/pimpilikipilapi1/NSFW_master"
8
  }
9
 
 
10
  def generate_image(text, model_name):
11
  model_path = models[model_name]
12
+ print(f"Fetching model from: {model_path}")
13
+
14
+ try:
15
+ model = gr.load(model_path)
16
+ result_image = model(text)
17
+ return result_image
18
+ except Exception as e:
19
+ print(f"Error loading model: {e}")
20
+ return None
21
 
22
 
23
  interface = gr.Interface(
24
  fn=generate_image,
25
  inputs=[
26
+ gr.Textbox(label="Type here your imagination:", placeholder="Type your description here..."),
27
  gr.Dropdown(label="Select Model", choices=list(models.keys()), value="Flux Lora")
28
  ],
29
  outputs=gr.Image(label="Generated Image"),
 
31
  description="Sorry for the inconvenience. The model is currently running on the CPU, which might affect performance. We appreciate your understanding.",
32
  )
33
 
34
+
35
+ interface.launch()