Spaces:
Paused
Paused
update
Browse files
app.py
CHANGED
@@ -71,11 +71,12 @@ def resize_image(image, max_size):
|
|
71 |
resized_image = image.resize((new_width, new_height))
|
72 |
return resized_image
|
73 |
|
|
|
74 |
def http_bot(image_input, text_input, request: gr.Request):
|
75 |
logger.info(f"http_bot. ip: {request.client.host}")
|
76 |
print(f"Prompt request: {text_input}")
|
77 |
|
78 |
-
base64_image_str = encode_image(image_input)
|
79 |
|
80 |
payload = {
|
81 |
"content": [
|
@@ -95,7 +96,7 @@ def http_bot(image_input, text_input, request: gr.Request):
|
|
95 |
},
|
96 |
)
|
97 |
|
98 |
-
url = "https://
|
99 |
headers = {"Content-Type": "application/json"}
|
100 |
|
101 |
response = requests.post(url, headers=headers, data=json.dumps(payload))
|
@@ -103,10 +104,13 @@ def http_bot(image_input, text_input, request: gr.Request):
|
|
103 |
print("response: ", {"result": results["result"]})
|
104 |
return results["result"]
|
105 |
|
|
|
106 |
title = """
|
107 |
# OTTER-HD: A High-Resolution Multi-modality Model
|
108 |
[[Otter Codebase]](https://github.com/Luodian/Otter) [[Paper]]() [[Checkpoints & Benchmarks]](https://huggingface.co/Otter-AI)
|
109 |
-
|
|
|
|
|
110 |
"""
|
111 |
|
112 |
css = """
|
@@ -163,4 +167,4 @@ if __name__ == "__main__":
|
|
163 |
)
|
164 |
vqa_btn.click(fn=http_bot, inputs=[image_input, text_input], outputs=vqa_output)
|
165 |
|
166 |
-
demo.launch()
|
|
|
71 |
resized_image = image.resize((new_width, new_height))
|
72 |
return resized_image
|
73 |
|
74 |
+
|
75 |
def http_bot(image_input, text_input, request: gr.Request):
|
76 |
logger.info(f"http_bot. ip: {request.client.host}")
|
77 |
print(f"Prompt request: {text_input}")
|
78 |
|
79 |
+
base64_image_str = encode_image(image_input)
|
80 |
|
81 |
payload = {
|
82 |
"content": [
|
|
|
96 |
},
|
97 |
)
|
98 |
|
99 |
+
url = "https://ensures-picture-choices-labels.trycloudflare.com/app/otter"
|
100 |
headers = {"Content-Type": "application/json"}
|
101 |
|
102 |
response = requests.post(url, headers=headers, data=json.dumps(payload))
|
|
|
104 |
print("response: ", {"result": results["result"]})
|
105 |
return results["result"]
|
106 |
|
107 |
+
|
108 |
title = """
|
109 |
# OTTER-HD: A High-Resolution Multi-modality Model
|
110 |
[[Otter Codebase]](https://github.com/Luodian/Otter) [[Paper]]() [[Checkpoints & Benchmarks]](https://huggingface.co/Otter-AI)
|
111 |
+
|
112 |
+
**Tips**:
|
113 |
+
- Since 1024x1024 images are large that may cause the transmit time from HF Space to our backend server. Please be kinda patient for the response.
|
114 |
"""
|
115 |
|
116 |
css = """
|
|
|
167 |
)
|
168 |
vqa_btn.click(fn=http_bot, inputs=[image_input, text_input], outputs=vqa_output)
|
169 |
|
170 |
+
demo.launch()
|