EmanHassan26 commited on
Commit
5610674
·
verified ·
1 Parent(s): 5486c62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -2,17 +2,16 @@ import gradio as gr
2
  import spaces
3
  import torch
4
  import os
 
5
 
6
  @spaces.GPU
7
  def greet(n):
8
  print(zero.device) # <-- 'cuda:0' 🤗
9
  return f"Hello {zero + n} Tensor"
10
 
11
- #demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
12
- #demo.launch()
13
 
14
 
15
- import gradio as gr
16
 
17
  IMAGE_FOLDER = "./images" # Change this to your folder path
18
 
@@ -29,6 +28,11 @@ def load_image(selected_file):
29
  return None
30
  return os.path.join(IMAGE_FOLDER, selected_file)
31
 
 
 
 
 
 
32
  # Generation pipeline function using both the source image and text prompt
33
  def process_and_generate(selected_file, prompt):
34
  if not selected_file:
@@ -92,7 +96,11 @@ with gr.Blocks() as demo:
92
  inputs=image_dropdown,
93
  outputs=input_preview
94
  )
95
-
 
 
 
 
96
  generate_btn.click(
97
  fn=process_and_generate,
98
  inputs=[image_dropdown, prompt_input],
 
2
  import spaces
3
  import torch
4
  import os
5
+ import gradio as gr
6
 
7
  @spaces.GPU
8
  def greet(n):
9
  print(zero.device) # <-- 'cuda:0' 🤗
10
  return f"Hello {zero + n} Tensor"
11
 
 
 
12
 
13
 
14
+
15
 
16
  IMAGE_FOLDER = "./images" # Change this to your folder path
17
 
 
28
  return None
29
  return os.path.join(IMAGE_FOLDER, selected_file)
30
 
31
+ # generate input image
32
+ def generate_input_image(image_path,input_choice):
33
+ print(f"image_path: '{image_path}'")
34
+ print(f"input_choice: '{input_choice}'")
35
+
36
  # Generation pipeline function using both the source image and text prompt
37
  def process_and_generate(selected_file, prompt):
38
  if not selected_file:
 
96
  inputs=image_dropdown,
97
  outputs=input_preview
98
  )
99
+ generate_inp_btn.click(
100
+ fn=generate_input_image,
101
+ inputs=[file_input,image_dropdown],
102
+ outputs=[]
103
+ )
104
  generate_btn.click(
105
  fn=process_and_generate,
106
  inputs=[image_dropdown, prompt_input],