iamrobotbear commited on
Commit
250a932
·
1 Parent(s): 968f9cc

once more try

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -74,7 +74,9 @@ def save_dataframe_to_csv(df):
74
  return temp_file_path
75
 
76
  # Main function to perform image captioning and image-text matching
77
- def process_images_and_statements(image, file):
 
 
78
  logging.info('Starting process_images_and_statements')
79
 
80
  # Generate image caption for the uploaded image using git-large-r-textcaps
@@ -121,13 +123,13 @@ def process_images_and_statements(image, file):
121
  return results_df, csv_results
122
 
123
  # Gradio interface
124
- image_input = gr.inputs.Image(type="file", label="Upload Image")
125
  output_df = gr.outputs.Dataframe(type="pandas", label="Results")
126
  output_csv = gr.outputs.File(label="Download CSV")
127
 
128
  iface = gr.Interface(
129
  fn=process_images_and_statements,
130
- inputs=[image_input],
131
  outputs=[output_df, output_csv],
132
  title="Image Captioning and Image-Text Matching",
133
  theme='sudeepshouche/minimalist',
 
74
  return temp_file_path
75
 
76
  # Main function to perform image captioning and image-text matching
77
+ def process_images_and_statements(image_file):
78
+ image = Image.open(image_file)
79
+ image = np.array(image)
80
  logging.info('Starting process_images_and_statements')
81
 
82
  # Generate image caption for the uploaded image using git-large-r-textcaps
 
123
  return results_df, csv_results
124
 
125
  # Gradio interface
126
+ image_input = gr.inputs.File(label="Upload Image")
127
  output_df = gr.outputs.Dataframe(type="pandas", label="Results")
128
  output_csv = gr.outputs.File(label="Download CSV")
129
 
130
  iface = gr.Interface(
131
  fn=process_images_and_statements,
132
+ inputs=image_input,
133
  outputs=[output_df, output_csv],
134
  title="Image Captioning and Image-Text Matching",
135
  theme='sudeepshouche/minimalist',