Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -39,7 +39,7 @@ else:
|
|
39 |
args.contolnet_device = "cpu"
|
40 |
|
41 |
def get_openai_key():
|
42 |
-
return os.getenv("
|
43 |
|
44 |
def pil_image_to_base64(image):
|
45 |
buffered = BytesIO()
|
@@ -101,11 +101,12 @@ def process_image(image_src, options=None, processor=None):
|
|
101 |
processor = ImageTextTransformation(args)
|
102 |
|
103 |
# Create Gradio input and output components
|
104 |
-
|
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 |
|
110 |
extra_title = r'![vistors](https://visitor-badge.glitch.me/badge?page_id=fingerrec.Image2Paragraph)' + '\n' + \
|
111 |
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'
|
|
|
39 |
args.contolnet_device = "cpu"
|
40 |
|
41 |
def get_openai_key():
|
42 |
+
return os.getenv("OPENAI_API_KEY","")
|
43 |
|
44 |
def pil_image_to_base64(image):
|
45 |
buffered = BytesIO()
|
|
|
101 |
processor = ImageTextTransformation(args)
|
102 |
|
103 |
# Create Gradio input and output components
|
104 |
+
openai_api_key = gr.inputs.Textbox(value=get_openai_key(),label="OpenAI API Key",type="password")
|
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'
|