Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -103,43 +103,34 @@ def respond(message, history: list[tuple[str, str]], model, system_message, max_
|
|
103 |
response += token
|
104 |
yield response
|
105 |
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
|
|
108 |
respond,
|
109 |
-
|
110 |
-
|
111 |
-
description="Hi there! I am your friendly AI chatbot. Choose from different language models under the Additional Inputs tab below.",
|
112 |
-
examples=[["Explain quantum computing"], ["Explain forex trading"], ["What is the capital of China?"], ["Make a poem about nature"]],
|
113 |
-
additional_inputs=[
|
114 |
-
gr.Dropdown(["DeepSeek-R1-Distill-Qwen-1.5B", "DeepSeek-R1-Distill-Qwen-32B", "Gemma-2-2b", "Gemma-7b", "Llama2-13b-chat", "Llama3-8b-Instruct", "Llama3.1-8b-Instruct", "Llama-3.2-11B-Vision-Instruct", "Microsoft-phi-2", "Mixtral-8x7B-Instruct", "Qwen2.5-Coder-32B-Instruct", "Zephyr-7b-beta"], label="Select Model"),
|
115 |
-
gr.Textbox(value="You are a friendly and helpful Chatbot, be concise and straight to the point, avoid excessive reasoning.", label="System message"),
|
116 |
-
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
117 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
118 |
-
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)")
|
119 |
-
|
120 |
-
]
|
121 |
-
)
|
122 |
-
|
123 |
-
while mode == "image-to-text":
|
124 |
-
demo = gr.ChatInterface(
|
125 |
respond,
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
)
|
|
|
143 |
|
144 |
|
145 |
if __name__ == "__main__":
|
|
|
103 |
response += token
|
104 |
yield response
|
105 |
|
106 |
+
|
107 |
+
|
108 |
+
|
109 |
+
demo = gr.ChatInterface(
|
110 |
+
|
111 |
+
if mode=="text-to-text":
|
112 |
respond,
|
113 |
+
multimodal=False,
|
114 |
+
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
respond,
|
116 |
+
multimodal=True,
|
117 |
+
stop_btn = "Stop generation",
|
118 |
+
# multimodal = True,
|
119 |
+
title="Ask me anything",
|
120 |
+
description="Hi there! I am your friendly AI chatbot. Choose from different language models under the Additional Inputs tab below.",
|
121 |
+
examples=[["Explain quantum computing"], ["Explain forex trading"], ["What is the capital of China?"], ["Make a poem about nature"]],
|
122 |
+
additional_inputs=[
|
123 |
+
gr.Dropdown(["DeepSeek-R1-Distill-Qwen-1.5B", "DeepSeek-R1-Distill-Qwen-32B", "Gemma-2-2b", "Gemma-7b", "Llama2-13b-chat", "Llama3-8b-Instruct", "Llama3.1-8b-Instruct", "Llama-3.2-11B-Vision-Instruct", "Microsoft-phi-2", "Mixtral-8x7B-Instruct", "Qwen2.5-Coder-32B-Instruct", "Zephyr-7b-beta"], label="Select Model"),
|
124 |
+
gr.Textbox(value="You are a friendly and helpful Chatbot, be concise and straight to the point, avoid excessive reasoning.", label="System message"),
|
125 |
+
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
126 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
127 |
+
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)")
|
128 |
+
|
129 |
+
],
|
130 |
+
|
131 |
+
url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/0052a70beed5bf71b92610a43a52df6d286cd5f3/diffusers/rabbit.jpg",
|
132 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
133 |
+
)
|
134 |
|
135 |
|
136 |
if __name__ == "__main__":
|