JustKiddo commited on
Commit
7c56fd1
·
verified ·
1 Parent(s): 09ee0b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -19,8 +19,13 @@ def sepia(input_img):
19
  ## https://www.gradio.app/docs/gradio/blocks
20
  ## required positional arguments: 'inputs' and 'outputs'
21
  def process_image(image):
22
- # Your image processing logic here
23
- return "Processed Text"
 
 
 
 
 
24
 
25
  def additional_input(text):
26
  return f"Additional input received: {text}"
@@ -35,7 +40,12 @@ with gr.Blocks() as generated_output:
35
  inputs=gr.Image(),
36
  outputs=[output_img, sepia_values_text],
37
  show_progress="full")
38
-
 
 
 
 
 
39
  #with gr.Blocks() as generated_output:
40
  # inp = gr.Interface(sepia, gr.Image(), "image")
41
  # out = gr.Textbox()
 
19
  ## https://www.gradio.app/docs/gradio/blocks
20
  ## required positional arguments: 'inputs' and 'outputs'
21
  def process_image(image):
22
+ # Convert the input image to the format expected by the model
23
+ input_img = np.array(input_img)
24
+ # Run the image through the model
25
+ result = client(inputs=input_img)
26
+ # Extract the text from the result
27
+ text = result['text']
28
+ return text
29
 
30
  def additional_input(text):
31
  return f"Additional input received: {text}"
 
40
  inputs=gr.Image(),
41
  outputs=[output_img, sepia_values_text],
42
  show_progress="full")
43
+ with gr.Row():
44
+ gr.Interface(
45
+ fn=process_image,
46
+ inputs=output_img,
47
+ outputs=gr.Textbox(label="Recognized Text"),
48
+ show_progress="full")
49
  #with gr.Blocks() as generated_output:
50
  # inp = gr.Interface(sepia, gr.Image(), "image")
51
  # out = gr.Textbox()