shideqin commited on
Commit
21ed484
1 Parent(s): 74f0514

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -52,7 +52,7 @@ def add_logo():
52
  logo_base64 = base64.b64encode(f.read()).decode()
53
  return logo_base64
54
 
55
- def process_image(api_key, image_src, options=None, processor=None):
56
  os.environ["OPENAI_API_KEY"] = api_key
57
  print(options)
58
  if options is None:
@@ -108,14 +108,14 @@ semantic_segment_checkbox = gr.inputs.Checkbox(label="Semantic Segment", default
108
  image_generation_checkbox = gr.inputs.Checkbox(label="Image Generation", default=False)
109
 
110
 
111
- extra_title = r'![vistors](https://visitor-badge.glitch.me/badge?page_id=fingerrec.Image2Paragraph)\n\n'
112
 
113
 
114
 
115
  logo_base64 = add_logo()
116
  # Create the title with the logo
117
  title_with_logo = \
118
- f'Understanding Image with Text\n\n<img src="data:image/jpeg;base64,{logo_base64}" width="400" style="vertical-align: middle;">'
119
 
120
  examples = [
121
  ["examples/test_4.jpg"],
@@ -123,9 +123,9 @@ examples = [
123
 
124
  # Create Gradio interface
125
  interface = gr.Interface(
126
- fn=lambda api_key, image, options: process_image(api_key, image, options, processor),
127
- inputs=[openai_api_key,
128
- image_input,
129
  gr.CheckboxGroup(
130
  label="Options",
131
  choices=["Image Generation", "Semantic Segment"],
 
52
  logo_base64 = base64.b64encode(f.read()).decode()
53
  return logo_base64
54
 
55
+ def process_image(image_src, api_key, options=None, processor=None):
56
  os.environ["OPENAI_API_KEY"] = api_key
57
  print(options)
58
  if options is None:
 
108
  image_generation_checkbox = gr.inputs.Checkbox(label="Image Generation", default=False)
109
 
110
 
111
+ extra_title = r'![vistors](https://visitor-badge.glitch.me/badge?page_id=fingerrec.Image2Paragraph)'+'\n\n'
112
 
113
 
114
 
115
  logo_base64 = add_logo()
116
  # Create the title with the logo
117
  title_with_logo = \
118
+ f'Understanding Image with Text'+'\n\n'+'<img src="data:image/jpeg;base64,{logo_base64}" width="400" style="vertical-align: middle;">'
119
 
120
  examples = [
121
  ["examples/test_4.jpg"],
 
123
 
124
  # Create Gradio interface
125
  interface = gr.Interface(
126
+ fn=lambda image, api_key, options: process_image(image, api_key, options, processor),
127
+ inputs=[image_input,
128
+ openai_api_key,
129
  gr.CheckboxGroup(
130
  label="Options",
131
  choices=["Image Generation", "Semantic Segment"],