Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,7 +28,7 @@ def image_to_base64(image_path):
|
|
| 28 |
encoded_string = base64.b64encode(img.read()).decode('utf-8')
|
| 29 |
return f"data:image/jpeg;base64,{encoded_string}"
|
| 30 |
|
| 31 |
-
@spaces.GPU
|
| 32 |
def run_inference(image_url, prompt):
|
| 33 |
base64 = image_to_base64(image_url)
|
| 34 |
completion_request = ChatCompletionRequest(messages=[UserMessage(content=[ImageURLChunk(image_url=base64), TextChunk(text=prompt)])])
|
|
@@ -51,7 +51,7 @@ with gr.Blocks() as demo:
|
|
| 51 |
height=750
|
| 52 |
)
|
| 53 |
text_box = gr.Textbox(
|
| 54 |
-
placeholder="Enter text and press enter, or upload an image",
|
| 55 |
container=False,
|
| 56 |
)
|
| 57 |
|
|
|
|
| 28 |
encoded_string = base64.b64encode(img.read()).decode('utf-8')
|
| 29 |
return f"data:image/jpeg;base64,{encoded_string}"
|
| 30 |
|
| 31 |
+
@spaces.GPU(duration=30)
|
| 32 |
def run_inference(image_url, prompt):
|
| 33 |
base64 = image_to_base64(image_url)
|
| 34 |
completion_request = ChatCompletionRequest(messages=[UserMessage(content=[ImageURLChunk(image_url=base64), TextChunk(text=prompt)])])
|
|
|
|
| 51 |
height=750
|
| 52 |
)
|
| 53 |
text_box = gr.Textbox(
|
| 54 |
+
placeholder="Enter your text and press enter, or upload an image.",
|
| 55 |
container=False,
|
| 56 |
)
|
| 57 |
|