Vihang28 commited on
Commit
e4fb0ba
·
verified ·
1 Parent(s): f8083e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -26,8 +26,7 @@ def pdf_to_img(pdf_path):
26
  img.save(open(f"image{counter}.{extention}","wb"))
27
  img_list.append(f"image{counter}.{extention}")
28
  counter += 1
29
- img_list_len = len(img_list)
30
- return (img_list,img_list_len)
31
 
32
  # def show_images(image_name):
33
  # return image_name
@@ -112,8 +111,6 @@ with gr.Blocks(theme=gr.themes.Glass(primary_hue=gr.themes.colors.stone)) as dem
112
  file_input = gr.File(type="filepath", label="Upload .pdf file")
113
  output_img_name = gr.Textbox(label="Image names")
114
  upload_button = gr.Button(value="Show Image Names")
115
- img_list_len = 0
116
- print(img_list_len)
117
  with gr.Row():
118
  with gr.Column():
119
  image_name = gr.Textbox(label="""
@@ -129,7 +126,7 @@ with gr.Blocks(theme=gr.themes.Glass(primary_hue=gr.themes.colors.stone)) as dem
129
  chatbot = gr.Chatbot()
130
  message = gr.Textbox(label="User", placeholder=prompt)
131
  state = gr.State()
132
- upload_button.click(pdf_to_img, inputs=file_input, outputs=[output_img_name,img_list_len])
133
 
134
  show_button.click(concate_image, inputs=image_name, outputs=output_img)
135
  show_concat.click(message_and_history, inputs=[output_img, message, state, api_input], outputs=[chatbot, state])
 
26
  img.save(open(f"image{counter}.{extention}","wb"))
27
  img_list.append(f"image{counter}.{extention}")
28
  counter += 1
29
+ return (img_list)
 
30
 
31
  # def show_images(image_name):
32
  # return image_name
 
111
  file_input = gr.File(type="filepath", label="Upload .pdf file")
112
  output_img_name = gr.Textbox(label="Image names")
113
  upload_button = gr.Button(value="Show Image Names")
 
 
114
  with gr.Row():
115
  with gr.Column():
116
  image_name = gr.Textbox(label="""
 
126
  chatbot = gr.Chatbot()
127
  message = gr.Textbox(label="User", placeholder=prompt)
128
  state = gr.State()
129
+ upload_button.click(pdf_to_img, inputs=file_input, outputs=output_img_name)
130
 
131
  show_button.click(concate_image, inputs=image_name, outputs=output_img)
132
  show_concat.click(message_and_history, inputs=[output_img, message, state, api_input], outputs=[chatbot, state])