shideqin commited on
Commit
c265fbf
1 Parent(s): c5addd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -4,6 +4,15 @@ import gradio as gr
4
  def get_openai_key():
5
  return os.getenv("OPENAI_API_KEY","")
6
 
 
 
 
 
 
 
 
 
 
7
  openai_api_key = gr.inputs.Textbox(label="OpenAI API Key",type="password")
8
  image_input = gr.inputs.Image(type='filepath', label="Input Image")
9
 
@@ -14,6 +23,7 @@ extra_title = r'![vistors](https://visitor-badge.glitch.me/badge?page_id=fingerr
14
  r'[![Duplicate this Space](https://huggingface.co/datasets/huggingface/badges/raw/main/duplicate-this-space-md-dark.svg)](https://huggingface.co/spaces/Awiny/Image2Paragraph?duplicate=true)' + '\n\n'
15
 
16
  interface = gr.Interface(
 
17
  inputs=[openai_api_key,
18
  image_input,
19
  gr.CheckboxGroup(
 
4
  def get_openai_key():
5
  return os.getenv("OPENAI_API_KEY","")
6
 
7
+ def process_image(image_src):
8
+ print(image_src)
9
+ # Combine the outputs into a single HTML output
10
+ custom_output = f'''
11
+ <h2>Image->Text:</h2>
12
+ '''
13
+ return custom_output
14
+
15
+
16
  openai_api_key = gr.inputs.Textbox(label="OpenAI API Key",type="password")
17
  image_input = gr.inputs.Image(type='filepath', label="Input Image")
18
 
 
23
  r'[![Duplicate this Space](https://huggingface.co/datasets/huggingface/badges/raw/main/duplicate-this-space-md-dark.svg)](https://huggingface.co/spaces/Awiny/Image2Paragraph?duplicate=true)' + '\n\n'
24
 
25
  interface = gr.Interface(
26
+ fn=lambda image, options: process_image(image),
27
  inputs=[openai_api_key,
28
  image_input,
29
  gr.CheckboxGroup(