Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,22 +36,22 @@ def upload_img(image,api_key,img_ques):
|
|
| 36 |
img_preview = response.json()
|
| 37 |
return img_preview["choices"][0]["message"]["content"]
|
| 38 |
|
| 39 |
-
title = """<h1 align="center">GPT-4 Preview</h1>"""
|
| 40 |
|
| 41 |
-
with
|
| 42 |
-
|
| 43 |
|
| 44 |
-
with
|
| 45 |
-
with
|
| 46 |
-
image_input =
|
| 47 |
-
key_input =
|
| 48 |
-
upload_button =
|
| 49 |
-
btn_clear =
|
| 50 |
|
| 51 |
-
with
|
| 52 |
-
text =
|
| 53 |
-
ques_input =
|
| 54 |
-
ques_clear =
|
| 55 |
|
| 56 |
upload_button.click(upload_img, inputs=[image_input,key_input,ques_input], outputs=text)
|
| 57 |
btn_clear.add(text)
|
|
|
|
| 36 |
img_preview = response.json()
|
| 37 |
return img_preview["choices"][0]["message"]["content"]
|
| 38 |
|
| 39 |
+
title = """<h1 align="center">GPT-4 Image Preview</h1>"""
|
| 40 |
|
| 41 |
+
with gradio.Blocks() as demo:
|
| 42 |
+
gradio.Markdown(title)
|
| 43 |
|
| 44 |
+
with gradio.Row():
|
| 45 |
+
with gradio.Column():
|
| 46 |
+
image_input = gradio.Image(type="filepath", label="Upload Image")
|
| 47 |
+
key_input = gradio.Textbox(label="Enter API-key")
|
| 48 |
+
upload_button = gradio.Button(value="Upload & Start Chat", interactive=True, variant="primary")
|
| 49 |
+
btn_clear = gradio.ClearButton([image_input,key_input],[text])
|
| 50 |
|
| 51 |
+
with gradio.Column():
|
| 52 |
+
text = gradio.Textbox(label="Output")
|
| 53 |
+
ques_input = gradio.Textbox(label="Enter the question")
|
| 54 |
+
ques_clear = gradio.ClearButton([ques_input])
|
| 55 |
|
| 56 |
upload_button.click(upload_img, inputs=[image_input,key_input,ques_input], outputs=text)
|
| 57 |
btn_clear.add(text)
|