Spaces:
Sleeping
Sleeping
Refactor app.py and update dependencies
Browse files
app.py
CHANGED
@@ -1,15 +1,10 @@
|
|
1 |
-
import torch
|
2 |
import spaces
|
3 |
-
from transformers import (
|
4 |
-
BitsAndBytesConfig,
|
5 |
-
)
|
6 |
from transformers import (
|
7 |
TextIteratorStreamer,
|
8 |
-
AutoModelForCausalLM,
|
9 |
-
CodeGenTokenizerFast as Tokenizer,
|
10 |
)
|
11 |
from transformers import (
|
12 |
AutoProcessor,
|
|
|
13 |
LlavaForConditionalGeneration,
|
14 |
)
|
15 |
from PIL import Image
|
@@ -25,7 +20,8 @@ from datetime import datetime
|
|
25 |
import pytz
|
26 |
from gradio.components import LoginButton
|
27 |
from typing import Optional
|
28 |
-
|
|
|
29 |
from theme import Seafoam
|
30 |
|
31 |
|
@@ -225,7 +221,10 @@ with gr.Blocks(
|
|
225 |
with gr.Row():
|
226 |
with gr.Column(scale=3):
|
227 |
about_you = gr.Textbox(
|
228 |
-
label="About you",
|
|
|
|
|
|
|
229 |
)
|
230 |
image_input = gr.Image(
|
231 |
label="Upload your meal image", height=350, type="pil"
|
@@ -258,18 +257,20 @@ with gr.Blocks(
|
|
258 |
height=700,
|
259 |
show_copy_button=True,
|
260 |
latex_delimiters=latex_delimiters_set,
|
|
|
261 |
)
|
262 |
text_input = gr.Textbox(
|
263 |
label="Ask about your meal",
|
264 |
placeholder="(Optional) Enter your message here...",
|
265 |
lines=1,
|
266 |
container=False,
|
|
|
267 |
)
|
268 |
with gr.Row():
|
269 |
send_btn = gr.Button("Send", variant="primary", visible=True)
|
270 |
login_button = LoginButton(visible=True, value="Login")
|
271 |
clear_btn = gr.Button(
|
272 |
-
"Delete my
|
273 |
variant="stop",
|
274 |
visible=True,
|
275 |
)
|
|
|
|
|
1 |
import spaces
|
|
|
|
|
|
|
2 |
from transformers import (
|
3 |
TextIteratorStreamer,
|
|
|
|
|
4 |
)
|
5 |
from transformers import (
|
6 |
AutoProcessor,
|
7 |
+
BitsAndBytesConfig,
|
8 |
LlavaForConditionalGeneration,
|
9 |
)
|
10 |
from PIL import Image
|
|
|
20 |
import pytz
|
21 |
from gradio.components import LoginButton
|
22 |
from typing import Optional
|
23 |
+
from transformers import AutoModelForCausalLM, CodeGenTokenizerFast as Tokenizer
|
24 |
+
import torch
|
25 |
from theme import Seafoam
|
26 |
|
27 |
|
|
|
221 |
with gr.Row():
|
222 |
with gr.Column(scale=3):
|
223 |
about_you = gr.Textbox(
|
224 |
+
label="About you",
|
225 |
+
placeholder="Add information about you here...",
|
226 |
+
lines=3,
|
227 |
+
interactive=True,
|
228 |
)
|
229 |
image_input = gr.Image(
|
230 |
label="Upload your meal image", height=350, type="pil"
|
|
|
257 |
height=700,
|
258 |
show_copy_button=True,
|
259 |
latex_delimiters=latex_delimiters_set,
|
260 |
+
type="messages",
|
261 |
)
|
262 |
text_input = gr.Textbox(
|
263 |
label="Ask about your meal",
|
264 |
placeholder="(Optional) Enter your message here...",
|
265 |
lines=1,
|
266 |
container=False,
|
267 |
+
interactive=True,
|
268 |
)
|
269 |
with gr.Row():
|
270 |
send_btn = gr.Button("Send", variant="primary", visible=True)
|
271 |
login_button = LoginButton(visible=True, value="Login")
|
272 |
clear_btn = gr.Button(
|
273 |
+
"Delete my history",
|
274 |
variant="stop",
|
275 |
visible=True,
|
276 |
)
|