Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -52,7 +52,8 @@ def add_logo():
|
|
52 |
logo_base64 = base64.b64encode(f.read()).decode()
|
53 |
return logo_base64
|
54 |
|
55 |
-
def process_image(image_src, options=None, processor=None):
|
|
|
56 |
print(options)
|
57 |
if options is None:
|
58 |
options = []
|
@@ -101,12 +102,11 @@ def process_image(image_src, options=None, processor=None):
|
|
101 |
processor = ImageTextTransformation(args)
|
102 |
|
103 |
# Create Gradio input and output components
|
104 |
-
openai_api_key = gr.
|
105 |
image_input = gr.inputs.Image(type='filepath', label="Input Image")
|
106 |
semantic_segment_checkbox = gr.inputs.Checkbox(label="Semantic Segment", default=False)
|
107 |
image_generation_checkbox = gr.inputs.Checkbox(label="Image Generation", default=False)
|
108 |
|
109 |
-
os.environ["OPENAI_API_KEY"] = openai_api_key
|
110 |
|
111 |
extra_title = r'![vistors](https://visitor-badge.glitch.me/badge?page_id=fingerrec.Image2Paragraph)' + '\n' + \
|
112 |
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'
|
@@ -124,7 +124,7 @@ examples = [
|
|
124 |
|
125 |
# Create Gradio interface
|
126 |
interface = gr.Interface(
|
127 |
-
fn=lambda image, options: process_image(image, options, processor),
|
128 |
inputs=[openai_api_key,
|
129 |
image_input,
|
130 |
gr.CheckboxGroup(
|
|
|
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:
|
59 |
options = []
|
|
|
102 |
processor = ImageTextTransformation(args)
|
103 |
|
104 |
# Create Gradio input and output components
|
105 |
+
openai_api_key = gr.Textbox(value=get_openai_key(),label="OpenAI API Key",type="password")
|
106 |
image_input = gr.inputs.Image(type='filepath', label="Input Image")
|
107 |
semantic_segment_checkbox = gr.inputs.Checkbox(label="Semantic Segment", default=False)
|
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' + \
|
112 |
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'
|
|
|
124 |
|
125 |
# Create Gradio interface
|
126 |
interface = gr.Interface(
|
127 |
+
fn=lambda api_key, image, options: process_image(api_key, image, options, processor),
|
128 |
inputs=[openai_api_key,
|
129 |
image_input,
|
130 |
gr.CheckboxGroup(
|