jyucknarui commited on
Commit
8764e6e
verified
1 Parent(s): da8e66d

Update app.py from anycoder

Browse files
Files changed (1) hide show
  1. app.py +23 -17
app.py CHANGED
@@ -110,6 +110,7 @@ def create_chatbot_app():
110
  # Carrega o modelo em background
111
  model_status = gr.Textbox("Carregando modelo...", visible=False)
112
 
 
113
  with gr.Blocks() as demo:
114
  # Header com branding
115
  gr.HTML("""
@@ -167,10 +168,10 @@ def create_chatbot_app():
167
  - Para melhores resultados, use idiomas que o modelo foi treinado
168
  """)
169
 
170
- # Configura eventos
171
- msg_input.submit(chat_function, [msg_input, chatbot_interface], [chatbot_interface, msg_input])
172
- submit_btn.click(chat_function, [msg_input, chatbot_interface], [chatbot_interface, msg_input])
173
- clear_btn.click(clear_chat, outputs=[chatbot_interface, msg_input])
174
 
175
  # Carrega o modelo ap贸s a interface ser criada
176
  demo.load(
@@ -183,20 +184,25 @@ def create_chatbot_app():
183
  # Cria e lan莽a o aplicativo
184
  if __name__ == "__main__":
185
  app = create_chatbot_app()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  app.launch(
187
- theme=gr.themes.Soft(
188
- primary_hue="blue",
189
- secondary_hue="indigo",
190
- neutral_hue="slate",
191
- font=gr.themes.GoogleFont("Inter"),
192
- text_size="lg",
193
- spacing_size="lg",
194
- radius_size="md"
195
- ).set(
196
- button_primary_background_fill="*primary_600",
197
- button_primary_background_fill_hover="*primary_700",
198
- block_title_text_weight="600",
199
- ),
200
  footer_links=[
201
  {"label": "Modelo no Hugging Face", "url": "https://huggingface.co/XiaomiMiMo/MiMo-V2-Flash"},
202
  {"label": "Built with anycoder", "url": "https://huggingface.co/spaces/akhaliq/anycoder"}
 
110
  # Carrega o modelo em background
111
  model_status = gr.Textbox("Carregando modelo...", visible=False)
112
 
113
+ # 馃毃 Gradio 6: NO parameters in gr.Blocks() constructor!
114
  with gr.Blocks() as demo:
115
  # Header com branding
116
  gr.HTML("""
 
168
  - Para melhores resultados, use idiomas que o modelo foi treinado
169
  """)
170
 
171
+ # Configura eventos - 馃毃 Gradio 6: Use api_visibility instead of api_name
172
+ msg_input.submit(chat_function, [msg_input, chatbot_interface], [chatbot_interface, msg_input], api_visibility="public")
173
+ submit_btn.click(chat_function, [msg_input, chatbot_interface], [chatbot_interface, msg_input], api_visibility="public")
174
+ clear_btn.click(clear_chat, outputs=[chatbot_interface, msg_input], api_visibility="public")
175
 
176
  # Carrega o modelo ap贸s a interface ser criada
177
  demo.load(
 
184
  # Cria e lan莽a o aplicativo
185
  if __name__ == "__main__":
186
  app = create_chatbot_app()
187
+
188
+ # 馃毃 Gradio 6: ALL app parameters go in demo.launch()!
189
+ # Create custom theme
190
+ custom_theme = gr.themes.Soft(
191
+ primary_hue="blue",
192
+ secondary_hue="indigo",
193
+ neutral_hue="slate",
194
+ font=gr.themes.GoogleFont("Inter"),
195
+ text_size="lg",
196
+ spacing_size="lg",
197
+ radius_size="md"
198
+ ).set(
199
+ button_primary_background_fill="*primary_600",
200
+ button_primary_background_fill_hover="*primary_700",
201
+ block_title_text_weight="600",
202
+ )
203
+
204
  app.launch(
205
+ theme=custom_theme, # 馃毃 Gradio 6: theme goes in launch()
 
 
 
 
 
 
 
 
 
 
 
 
206
  footer_links=[
207
  {"label": "Modelo no Hugging Face", "url": "https://huggingface.co/XiaomiMiMo/MiMo-V2-Flash"},
208
  {"label": "Built with anycoder", "url": "https://huggingface.co/spaces/akhaliq/anycoder"}