Spaces:
Running
on
Zero
Running
on
Zero
Update app_dialogue.py
Browse files- app_dialogue.py +8 -0
app_dialogue.py
CHANGED
|
@@ -77,6 +77,13 @@ def load_image_from_url(url):
|
|
| 77 |
image = Image.open(image_stream)
|
| 78 |
return image
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
def format_user_prompt_with_im_history_and_system_conditioning(
|
| 82 |
user_prompt, chat_history
|
|
@@ -386,6 +393,7 @@ with gr.Blocks(
|
|
| 386 |
dope_bttn = gr.Button("Dope🔥")
|
| 387 |
with gr.Column(scale=1, min_width=50):
|
| 388 |
problematic_bttn = gr.Button("Problematic😬")
|
|
|
|
| 389 |
dope_dataset_writer.setup(
|
| 390 |
[
|
| 391 |
model_selector,
|
|
|
|
| 77 |
image = Image.open(image_stream)
|
| 78 |
return image
|
| 79 |
|
| 80 |
+
def img_to_bytes(image_path):
|
| 81 |
+
image = Image.open(image_path)
|
| 82 |
+
buffer = io.BytesIO()
|
| 83 |
+
image.save(buffer, format="JPEG")
|
| 84 |
+
img_bytes = buffer.getvalue()
|
| 85 |
+
image.close()
|
| 86 |
+
return img_bytes
|
| 87 |
|
| 88 |
def format_user_prompt_with_im_history_and_system_conditioning(
|
| 89 |
user_prompt, chat_history
|
|
|
|
| 393 |
dope_bttn = gr.Button("Dope🔥")
|
| 394 |
with gr.Column(scale=1, min_width=50):
|
| 395 |
problematic_bttn = gr.Button("Problematic😬")
|
| 396 |
+
|
| 397 |
dope_dataset_writer.setup(
|
| 398 |
[
|
| 399 |
model_selector,
|