akhaliq HF Staff commited on
Commit
a7d7982
Β·
1 Parent(s): ab29198

remove login

Browse files
Files changed (1) hide show
  1. app.py +14 -73
app.py CHANGED
@@ -275,35 +275,33 @@ with gr.Blocks(css_paths="app.css") as demo:
275
  with antd.Row(gutter=[32, 12]) as layout:
276
  with antd.Col(span=24, md=8):
277
  with antd.Flex(vertical=True, gap="middle", wrap=True):
278
- gr.LoginButton()
279
- login_message = gr.Markdown("", visible=False)
280
  header = gr.HTML("""
281
  <div class="left_header">
282
  <img src="https://huggingface.co/spaces/akhaliq/anycoder/resolve/main/Animated_Logo_Video_Ready.gif" width="200px" />
283
  <h1>AnyCoder</h1>
284
  </div>
285
  """)
286
- current_model_display = gr.Markdown("**Current Model:** DeepSeek V3", visible=False)
287
  input = antd.InputTextarea(
288
- size="large", allow_clear=True, placeholder="Please enter what kind of application you want", visible=False)
289
  image_input = gr.Image(label="Upload an image (only for ERNIE-4.5-VL model)", visible=False)
290
- btn = antd.Button("send", type="primary", size="large", visible=False)
291
- clear_btn = antd.Button("clear history", type="default", size="large", visible=False)
292
 
293
- antd.Divider("examples", visible=False)
294
- with antd.Flex(gap="small", wrap=True, visible=False) as examples_flex:
295
  for i, demo_item in enumerate(DEMO_LIST):
296
  with antd.Card(hoverable=True, title=demo_item["title"]) as demoCard:
297
  antd.CardMeta(description=demo_item["description"])
298
  demoCard.click(lambda e, idx=i: (DEMO_LIST[idx]['description'], None), outputs=[input, image_input])
299
 
300
- antd.Divider("setting", visible=False)
301
- with antd.Flex(gap="small", wrap=True, visible=False) as setting_flex:
302
  settingPromptBtn = antd.Button(
303
- "βš™οΈ set system Prompt", type="default", visible=False)
304
- modelBtn = antd.Button("πŸ€– switch model", type="default", visible=False)
305
- codeBtn = antd.Button("πŸ§‘β€πŸ’» view code", type="default", visible=False)
306
- historyBtn = antd.Button("πŸ“œ history", type="default", visible=False)
307
 
308
  with antd.Modal(open=False, title="set system Prompt", width="800px") as system_prompt_modal:
309
  systemPromptInput = antd.InputTextarea(
@@ -351,47 +349,7 @@ with gr.Blocks(css_paths="app.css") as demo:
351
  with antd.Tabs.Item(key="loading"):
352
  loading = antd.Spin(True, tip="coding...", size="large", elem_classes="right_content")
353
 
354
- def update_login_ui(profile: gr.OAuthProfile | None):
355
- if profile is None:
356
- return (
357
- gr.update(value="**You must sign in with Hugging Face to use this app.**", visible=True),
358
- gr.update(visible=False),
359
- gr.update(visible=False),
360
- gr.update(visible=False),
361
- gr.update(visible=False),
362
- gr.update(visible=False),
363
- gr.update(visible=False),
364
- gr.update(visible=False),
365
- gr.update(visible=False),
366
- gr.update(visible=False),
367
- gr.update(visible=False),
368
- gr.update(visible=False),
369
- )
370
- else:
371
- return (
372
- gr.update(visible=False),
373
- gr.update(visible=True),
374
- gr.update(visible=False), # Image input hidden by default (DeepSeek V3)
375
- gr.update(visible=True),
376
- gr.update(visible=True),
377
- gr.update(visible=True),
378
- gr.update(visible=True),
379
- gr.update(visible=True),
380
- gr.update(visible=True),
381
- gr.update(visible=True),
382
- gr.update(visible=True),
383
- gr.update(visible=True),
384
- )
385
-
386
- def generation_code(query: Optional[str], image: Optional[gr.Image], _setting: Dict[str, str], _history: Optional[History], profile: gr.OAuthProfile | None, _current_model: Dict):
387
- if profile is None:
388
- return (
389
- "Please sign in with Hugging Face to use this feature.",
390
- _history,
391
- None,
392
- gr.update(active_key="empty"),
393
- gr.update(open=True),
394
- )
395
  if query is None:
396
  query = ''
397
  if _history is None:
@@ -452,24 +410,7 @@ with gr.Blocks(css_paths="app.css") as demo:
452
 
453
  clear_btn.click(clear_history, inputs=[], outputs=[history])
454
 
455
- demo.load(
456
- update_login_ui,
457
- inputs=None,
458
- outputs=[
459
- login_message,
460
- input,
461
- image_input,
462
- current_model_display,
463
- btn,
464
- clear_btn,
465
- examples_flex,
466
- setting_flex,
467
- settingPromptBtn,
468
- modelBtn,
469
- codeBtn,
470
- historyBtn,
471
- ]
472
- )
473
 
474
  if __name__ == "__main__":
475
  demo.queue(default_concurrency_limit=20).launch(ssr_mode=False)
 
275
  with antd.Row(gutter=[32, 12]) as layout:
276
  with antd.Col(span=24, md=8):
277
  with antd.Flex(vertical=True, gap="middle", wrap=True):
 
 
278
  header = gr.HTML("""
279
  <div class="left_header">
280
  <img src="https://huggingface.co/spaces/akhaliq/anycoder/resolve/main/Animated_Logo_Video_Ready.gif" width="200px" />
281
  <h1>AnyCoder</h1>
282
  </div>
283
  """)
284
+ current_model_display = gr.Markdown("**Current Model:** DeepSeek V3")
285
  input = antd.InputTextarea(
286
+ size="large", allow_clear=True, placeholder="Please enter what kind of application you want")
287
  image_input = gr.Image(label="Upload an image (only for ERNIE-4.5-VL model)", visible=False)
288
+ btn = antd.Button("send", type="primary", size="large")
289
+ clear_btn = antd.Button("clear history", type="default", size="large")
290
 
291
+ antd.Divider("examples")
292
+ with antd.Flex(gap="small", wrap=True) as examples_flex:
293
  for i, demo_item in enumerate(DEMO_LIST):
294
  with antd.Card(hoverable=True, title=demo_item["title"]) as demoCard:
295
  antd.CardMeta(description=demo_item["description"])
296
  demoCard.click(lambda e, idx=i: (DEMO_LIST[idx]['description'], None), outputs=[input, image_input])
297
 
298
+ antd.Divider("setting")
299
+ with antd.Flex(gap="small", wrap=True) as setting_flex:
300
  settingPromptBtn = antd.Button(
301
+ "βš™οΈ set system Prompt", type="default")
302
+ modelBtn = antd.Button("πŸ€– switch model", type="default")
303
+ codeBtn = antd.Button("πŸ§‘β€πŸ’» view code", type="default")
304
+ historyBtn = antd.Button("πŸ“œ history", type="default")
305
 
306
  with antd.Modal(open=False, title="set system Prompt", width="800px") as system_prompt_modal:
307
  systemPromptInput = antd.InputTextarea(
 
349
  with antd.Tabs.Item(key="loading"):
350
  loading = antd.Spin(True, tip="coding...", size="large", elem_classes="right_content")
351
 
352
+ def generation_code(query: Optional[str], image: Optional[gr.Image], _setting: Dict[str, str], _history: Optional[History], _current_model: Dict):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
353
  if query is None:
354
  query = ''
355
  if _history is None:
 
410
 
411
  clear_btn.click(clear_history, inputs=[], outputs=[history])
412
 
413
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
414
 
415
  if __name__ == "__main__":
416
  demo.queue(default_concurrency_limit=20).launch(ssr_mode=False)