Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -97,24 +97,25 @@ def process_vision_query(image, text_input):
|
|
97 |
response = vision_processor.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
98 |
return response
|
99 |
|
100 |
-
# Gradio interface
|
101 |
with gr.Blocks() as demo:
|
102 |
gr.HTML(TITLE)
|
103 |
gr.Markdown(DESCRIPTION)
|
104 |
|
105 |
with gr.Tab("Text Model (Phi-3.5-mini)"):
|
106 |
chatbot = gr.Chatbot(height=600)
|
107 |
-
gr.
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
|
|
118 |
|
119 |
with gr.Tab("Vision Model (Phi-3.5-vision)"):
|
120 |
with gr.Row():
|
|
|
97 |
response = vision_processor.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
98 |
return response
|
99 |
|
|
|
100 |
with gr.Blocks() as demo:
|
101 |
gr.HTML(TITLE)
|
102 |
gr.Markdown(DESCRIPTION)
|
103 |
|
104 |
with gr.Tab("Text Model (Phi-3.5-mini)"):
|
105 |
chatbot = gr.Chatbot(height=600)
|
106 |
+
msg = gr.Textbox(label="Message")
|
107 |
+
with gr.Accordion("Advanced Options", open=False):
|
108 |
+
system_prompt = gr.Textbox(value="You are a helpful assistant", label="System Prompt")
|
109 |
+
temperature = gr.Slider(minimum=0, maximum=1, step=0.1, value=0.8, label="Temperature")
|
110 |
+
max_new_tokens = gr.Slider(minimum=128, maximum=8192, step=1, value=1024, label="Max new tokens")
|
111 |
+
top_p = gr.Slider(minimum=0.0, maximum=1.0, step=0.1, value=1.0, label="top_p")
|
112 |
+
top_k = gr.Slider(minimum=1, maximum=20, step=1, value=20, label="top_k")
|
113 |
+
|
114 |
+
submit_btn = gr.Button("Submit")
|
115 |
+
clear_btn = gr.Button("Clear")
|
116 |
+
|
117 |
+
submit_btn.click(stream_text_chat, [msg, chatbot, system_prompt, temperature, max_new_tokens, top_p, top_k], [chatbot])
|
118 |
+
clear_btn.click(lambda: None, None, chatbot, queue=False)
|
119 |
|
120 |
with gr.Tab("Vision Model (Phi-3.5-vision)"):
|
121 |
with gr.Row():
|