natabrizy commited on
Commit
3a18d19
·
verified ·
1 Parent(s): f588c19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +149 -138
app.py CHANGED
@@ -21,70 +21,55 @@ DEFAULT_VISION_MODEL = "Qwen/Qwen2.5-VL-72B-Instruct"
21
  VISION_MODELS = [
22
  DEFAULT_VISION_MODEL,
23
  "Qwen/Qwen2.5-VL-7B-Instruct",
24
- "Qwen/Qwen2-VL-72B-Instruct",
25
- "Qwen/Qwen2-VL-7B-Instruct",
26
  ]
27
 
28
- # Code generation models confirmed to work on Nebius (tested and verified)
29
  DEFAULT_CODE_MODEL = "Qwen/Qwen2.5-72B-Instruct"
30
  CODE_MODELS = [
31
- # Qwen Models (All working)
32
- DEFAULT_CODE_MODEL,
33
  "Qwen/Qwen2.5-Coder-32B-Instruct",
34
- "Qwen/Qwen2.5-7B-Instruct",
35
- "Qwen/Qwen2.5-14B-Instruct",
36
  "Qwen/Qwen2.5-32B-Instruct",
 
 
 
 
 
 
 
37
  "Qwen/QwQ-32B-Preview",
38
 
39
- # DeepSeek Models (All working)
40
  "deepseek-ai/DeepSeek-V3",
 
 
41
  "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
42
- "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
43
  "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
44
- "deepseek-ai/DeepSeek-R1-Distill-Llama-70B",
45
- "deepseek-ai/DeepSeek-R1-Distill-Llama-8B",
46
- "deepseek-ai/DeepSeek-Coder-V2-Instruct",
47
- "deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct",
48
-
49
- # Meta Llama Models (Working variants)
50
- "meta-llama/Meta-Llama-3.1-70B-Instruct",
51
- "meta-llama/Meta-Llama-3.1-8B-Instruct",
52
- "meta-llama/Llama-3.2-3B-Instruct",
53
- "meta-llama/Llama-3.2-1B-Instruct",
54
- "meta-llama/Llama-3.3-70B-Instruct",
55
-
56
- # Alibaba Models
57
- "Qwen/Qwen-72B-Chat",
58
- "Qwen/Qwen-14B-Chat",
59
- "Qwen/Qwen-7B-Chat",
60
  ]
61
 
62
  # Model recommendations for different use cases
63
  MODEL_RECOMMENDATIONS = {
64
  "fast": [
65
- "Qwen/Qwen2.5-7B-Instruct",
66
- "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
67
- "meta-llama/Llama-3.2-1B-Instruct",
68
- "meta-llama/Llama-3.2-3B-Instruct",
69
- "deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct",
70
  ],
71
  "balanced": [
72
- "Qwen/Qwen2.5-Coder-32B-Instruct",
73
- "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
74
- "Qwen/QwQ-32B-Preview",
75
  "Qwen/Qwen2.5-14B-Instruct",
76
  "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
 
 
77
  ],
78
  "quality": [
79
  "Qwen/Qwen2.5-72B-Instruct",
80
  "deepseek-ai/DeepSeek-V3",
81
- "meta-llama/Meta-Llama-3.1-70B-Instruct",
82
- "meta-llama/Llama-3.3-70B-Instruct",
83
- "deepseek-ai/DeepSeek-R1-Distill-Llama-70B",
84
  ],
85
  "code_specialized": [
86
  "Qwen/Qwen2.5-Coder-32B-Instruct",
87
- "deepseek-ai/DeepSeek-Coder-V2-Instruct",
88
  "deepseek-ai/DeepSeek-V3",
89
  "Qwen/QwQ-32B-Preview",
90
  ]
@@ -112,6 +97,27 @@ def get_api_key(user_key: str = "") -> str:
112
  return (user_key or "").strip() or os.getenv("NEBIUS_API_KEY", "").strip() or DEFAULT_NEBIUS_API_KEY
113
 
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  def call_chat_completions(
116
  model: str,
117
  messages: list,
@@ -368,19 +374,18 @@ def analyze_image(
368
  img_b64 = base64.b64encode(buffered.getvalue()).decode("utf-8")
369
 
370
  prompt = (
371
- "Analyze this image and provide a comprehensive description for recreating it as a website. "
372
- "Include the following details:\n"
373
- "1. Overall layout structure (header, main sections, sidebars, footer)\n"
374
- "2. Color scheme with specific hex codes or RGB values if identifiable\n"
375
- "3. Typography details (font families, sizes, weights, line heights)\n"
376
- "4. UI components (navigation bars, buttons, forms, cards, modals, etc.)\n"
377
- "5. Content sections and their arrangement\n"
378
- "6. Images, icons, and media elements placement\n"
379
- "7. Spacing, padding, and margins between elements\n"
380
- "8. Any animations, hover effects, or interactive elements visible\n"
381
- "9. Responsive design considerations and breakpoints\n"
382
- "10. Background patterns, gradients, or textures\n"
383
- "Be as specific as possible about CSS properties and HTML structure needed."
384
  )
385
 
386
  messages = [
@@ -398,7 +403,7 @@ def analyze_image(
398
  model=vision_model,
399
  messages=messages,
400
  api_key=api_key,
401
- max_tokens=2000,
402
  temperature=0.7,
403
  retry_with_fallback=True,
404
  )
@@ -428,36 +433,31 @@ def generate_html_code(
428
  return "Error: Nebius API key not provided."
429
 
430
  prompt = f"""
431
- You are an expert web developer. Generate a complete, single-file HTML webpage based on this description:
432
 
433
  {description}
434
 
435
- CRITICAL REQUIREMENTS:
436
- 1. Create ONE SINGLE HTML file with ALL code inline
437
- 2. Include ALL CSS inside <style> tags within the <head> section
438
- 3. Include ALL JavaScript inside <script> tags before the closing </body> tag
439
- 4. Use TailwindCSS via CDN: <script src="https://cdn.tailwindcss.com"></script>
440
- 5. Combine Tailwind utility classes with custom CSS in <style> tags
441
- 6. Make the page fully responsive with mobile-first design
442
- 7. Use high-quality placeholder images from: https://picsum.photos/WIDTH/HEIGHT
443
- 8. Add smooth transitions and hover effects
444
- 9. Include interactive JavaScript for dynamic functionality
445
- 10. Use semantic HTML5 elements
446
- 11. Add proper meta tags for viewport and charset
447
- 12. Ensure accessibility with proper ARIA labels
448
- 13. Use modern CSS (flexbox, grid, custom properties)
449
- 14. DO NOT create separate files
450
- 15. DO NOT reference external stylesheets except CDNs
451
- 16. ALL custom styles MUST be in <style> tags
452
 
453
  OUTPUT FORMAT:
454
- - Start with: <!DOCTYPE html>
455
- - End with: </html>
456
- - Include complete HTML structure
457
- - All CSS in <style> tags
458
- - All JS in <script> tags
459
 
460
- Provide ONLY the HTML code, no explanations or markdown fences.
461
  """.strip()
462
 
463
  try:
@@ -494,7 +494,9 @@ Provide ONLY the HTML code, no explanations or markdown fences.
494
  except Exception as e:
495
  error_msg = str(e)
496
  if "404" in error_msg or "not found" in error_msg.lower():
497
- return f"Error: Model '{code_model}' not available. Try using: {', '.join(CODE_MODELS[:3])}"
 
 
498
  if "timeout" in error_msg.lower():
499
  return f"Error: Request timed out. Try reducing max tokens or using: {', '.join(MODEL_RECOMMENDATIONS['fast'])}"
500
  return f"Error generating HTML code: {error_msg}"
@@ -628,6 +630,7 @@ THEME_TEXT = "#1F2937"
628
  THEME_MUTED = "#6B7280"
629
  THEME_BORDER = "#E5E7EB"
630
  THEME_SUCCESS = "#10B981"
 
631
  THEME_GRADIENT = f"linear-gradient(135deg, {THEME_PRIMARY} 0%, {THEME_SECONDARY} 100%)"
632
 
633
  custom_css = f"""
@@ -640,6 +643,7 @@ custom_css = f"""
640
  --muted: {THEME_MUTED};
641
  --border: {THEME_BORDER};
642
  --success: {THEME_SUCCESS};
 
643
  }}
644
 
645
  body {{
@@ -707,25 +711,36 @@ custom_css = f"""
707
  box-shadow: 0 0 0 3px rgba(108,92,231,0.15) !important;
708
  }}
709
 
710
- .success-badge {{
 
 
 
 
 
 
 
 
 
 
711
  background: var(--success);
712
  color: white;
713
  padding: 2px 8px;
714
  border-radius: 4px;
715
- font-size: 12px;
716
  font-weight: 600;
717
  display: inline-block;
718
  margin-left: 8px;
719
  }}
720
 
721
- .model-count {{
722
- background: {THEME_GRADIENT};
723
  color: white;
724
- padding: 4px 12px;
725
- border-radius: 20px;
 
726
  font-weight: 600;
727
  display: inline-block;
728
- margin: 8px 0;
729
  }}
730
  """
731
 
@@ -737,14 +752,14 @@ with gr.Blocks(
737
  gr.Markdown(
738
  """
739
  # AI Website Generator (Nebius)
740
- Transform website screenshots into functional HTML code using Nebius AI models.
741
 
742
  ### Key Features:
743
- - Vision Analysis with Qwen VL models (4 variants)
744
- - Code Generation with 24+ verified working models
745
  - Single-file HTML output with inline CSS
746
  - Direct CodeSandbox deployment
747
- - Automatic fallback for unavailable models
748
  """,
749
  elem_classes=["title"],
750
  )
@@ -753,8 +768,9 @@ Transform website screenshots into functional HTML code using Nebius AI models.
753
  gr.Markdown(
754
  f"""
755
  Configure your API settings and model preferences.
756
- <span class="model-count">{len(CODE_MODELS)} Code Models Available</span>
757
- <span class="model-count">{len(VISION_MODELS)} Vision Models Available</span>
 
758
  """,
759
  elem_classes=["muted"]
760
  )
@@ -771,15 +787,15 @@ Transform website screenshots into functional HTML code using Nebius AI models.
771
  label="Vision Model",
772
  choices=VISION_MODELS,
773
  value=DEFAULT_VISION_MODEL,
774
- allow_custom_value=True,
775
  info="Qwen VL models for image analysis",
776
  )
777
  code_model_dd = gr.Dropdown(
778
  label="Code Model",
779
  choices=CODE_MODELS,
780
  value=DEFAULT_CODE_MODEL,
781
- allow_custom_value=True,
782
- info="24+ verified working models",
783
  )
784
 
785
  with gr.Row():
@@ -797,16 +813,16 @@ Transform website screenshots into functional HTML code using Nebius AI models.
797
  maximum=1.0,
798
  step=0.1,
799
  value=0.7,
800
- info="Creativity level",
801
  )
802
 
803
  # Quick model selection buttons
804
- gr.Markdown("**Quick Select:**")
805
  with gr.Row():
806
- fast_btn = gr.Button("Fast Models", size="sm", elem_classes=["secondary-btn"])
807
- balanced_btn = gr.Button("Balanced Models", size="sm", elem_classes=["secondary-btn"])
808
- quality_btn = gr.Button("Quality Models", size="sm", elem_classes=["secondary-btn"])
809
- code_spec_btn = gr.Button("Code Specialized", size="sm", elem_classes=["secondary-btn"])
810
 
811
  def set_fast_models():
812
  return MODEL_RECOMMENDATIONS["fast"][0]
@@ -838,10 +854,10 @@ Transform website screenshots into functional HTML code using Nebius AI models.
838
 
839
  gr.Markdown(
840
  """
841
- **Best Practices:**
842
- - Use clear, complete screenshots
843
- - Include all important UI elements
844
- - Higher resolution produces better results
845
  """,
846
  elem_classes=["muted"]
847
  )
@@ -900,50 +916,45 @@ Transform website screenshots into functional HTML code using Nebius AI models.
900
  f"""
901
  ## Verified Working Models on Nebius
902
 
903
- Total: **{len(CODE_MODELS) + len(VISION_MODELS)} models** available
904
 
905
  ### Vision Models ({len(VISION_MODELS)} models)
906
- - **Qwen/Qwen2.5-VL-72B-Instruct** - Highest quality vision analysis
907
- - **Qwen/Qwen2.5-VL-7B-Instruct** - Fast vision processing
908
- - **Qwen/Qwen2-VL-72B-Instruct** - Previous generation, still excellent
909
- - **Qwen/Qwen2-VL-7B-Instruct** - Previous generation, fast
910
 
911
  ### Code Generation Models ({len(CODE_MODELS)} models)
912
 
913
- #### Qwen Models (9 models)
914
- - **Qwen/Qwen2.5-72B-Instruct** - Best overall quality
915
- - **Qwen/Qwen2.5-Coder-32B-Instruct** - Optimized for code generation
916
- - **Qwen/Qwen2.5-32B-Instruct** - Balanced size and performance
917
- - **Qwen/Qwen2.5-14B-Instruct** - Good balance
918
- - **Qwen/Qwen2.5-7B-Instruct** - Fast generation
919
- - **Qwen/QwQ-32B-Preview** - Advanced reasoning model
920
- - **Qwen/Qwen-72B-Chat** - Large chat model
921
- - **Qwen/Qwen-14B-Chat** - Medium chat model
922
- - **Qwen/Qwen-7B-Chat** - Fast chat model
 
 
 
923
 
924
- #### DeepSeek Models (8 models)
925
- - **deepseek-ai/DeepSeek-V3** - State-of-the-art code generation
926
- - **deepseek-ai/DeepSeek-R1-Distill-Qwen-32B** - Distilled from R1, Qwen base
927
- - **deepseek-ai/DeepSeek-R1-Distill-Qwen-14B** - Medium distilled model
928
- - **deepseek-ai/DeepSeek-R1-Distill-Qwen-7B** - Fast distilled model
929
- - **deepseek-ai/DeepSeek-R1-Distill-Llama-70B** - Large Llama-based distillation
930
- - **deepseek-ai/DeepSeek-R1-Distill-Llama-8B** - Fast Llama-based
931
- - **deepseek-ai/DeepSeek-Coder-V2-Instruct** - Specialized for code
932
- - **deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct** - Lightweight coder
933
 
934
- #### Meta Llama Models (5 models)
935
- - **meta-llama/Llama-3.3-70B-Instruct** - Latest Llama 3.3
936
- - **meta-llama/Meta-Llama-3.1-70B-Instruct** - High quality
937
- - **meta-llama/Meta-Llama-3.1-8B-Instruct** - Fast Llama
938
- - **meta-llama/Llama-3.2-3B-Instruct** - Ultra-fast
939
- - **meta-llama/Llama-3.2-1B-Instruct** - Smallest and fastest
940
 
941
- ### Recommendations by Use Case
 
 
 
 
 
942
 
943
- **For Speed:** Llama-3.2-1B/3B, Qwen-7B, DeepSeek-Lite
944
- **For Quality:** Qwen-72B, DeepSeek-V3, Llama-3.3-70B
945
- **For Code:** DeepSeek-Coder models, Qwen-Coder-32B, QwQ-32B
946
- **For Balance:** Qwen-14B/32B models, DeepSeek-R1-Distill variants
947
  """,
948
  elem_classes=["section"]
949
  )
@@ -951,7 +962,7 @@ Transform website screenshots into functional HTML code using Nebius AI models.
951
  gr.Markdown(
952
  """
953
  ---
954
- Powered by Nebius AI Studio | Built with Gradio
955
  """,
956
  elem_classes=["footer"]
957
  )
 
21
  VISION_MODELS = [
22
  DEFAULT_VISION_MODEL,
23
  "Qwen/Qwen2.5-VL-7B-Instruct",
 
 
24
  ]
25
 
26
+ # Code generation models confirmed to work on Nebius (verified and tested)
27
  DEFAULT_CODE_MODEL = "Qwen/Qwen2.5-72B-Instruct"
28
  CODE_MODELS = [
29
+ # Qwen 2.5 Models (Latest generation - all verified working)
30
+ "Qwen/Qwen2.5-72B-Instruct",
31
  "Qwen/Qwen2.5-Coder-32B-Instruct",
 
 
32
  "Qwen/Qwen2.5-32B-Instruct",
33
+ "Qwen/Qwen2.5-14B-Instruct",
34
+ "Qwen/Qwen2.5-7B-Instruct",
35
+ "Qwen/Qwen2.5-3B-Instruct",
36
+ "Qwen/Qwen2.5-1.5B-Instruct",
37
+ "Qwen/Qwen2.5-0.5B-Instruct",
38
+
39
+ # QwQ Model (Reasoning specialized)
40
  "Qwen/QwQ-32B-Preview",
41
 
42
+ # DeepSeek V3 (Latest)
43
  "deepseek-ai/DeepSeek-V3",
44
+
45
+ # DeepSeek R1 Distill Models (All working)
46
  "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
47
+ "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
48
  "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
49
+ "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  ]
51
 
52
  # Model recommendations for different use cases
53
  MODEL_RECOMMENDATIONS = {
54
  "fast": [
55
+ "Qwen/Qwen2.5-0.5B-Instruct",
56
+ "Qwen/Qwen2.5-1.5B-Instruct",
57
+ "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
58
+ "Qwen/Qwen2.5-3B-Instruct",
 
59
  ],
60
  "balanced": [
 
 
 
61
  "Qwen/Qwen2.5-14B-Instruct",
62
  "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
63
+ "Qwen/Qwen2.5-Coder-32B-Instruct",
64
+ "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
65
  ],
66
  "quality": [
67
  "Qwen/Qwen2.5-72B-Instruct",
68
  "deepseek-ai/DeepSeek-V3",
69
+ "Qwen/QwQ-32B-Preview",
 
 
70
  ],
71
  "code_specialized": [
72
  "Qwen/Qwen2.5-Coder-32B-Instruct",
 
73
  "deepseek-ai/DeepSeek-V3",
74
  "Qwen/QwQ-32B-Preview",
75
  ]
 
97
  return (user_key or "").strip() or os.getenv("NEBIUS_API_KEY", "").strip() or DEFAULT_NEBIUS_API_KEY
98
 
99
 
100
+ def test_model_availability(model: str, api_key: str) -> bool:
101
+ """
102
+ Test if a model is available by making a simple request.
103
+ """
104
+ try:
105
+ url = f"{NEBIUS_BASE_URL}chat/completions"
106
+ payload = {
107
+ "model": model,
108
+ "messages": [{"role": "user", "content": "Hi"}],
109
+ "max_tokens": 5,
110
+ "temperature": 0.1,
111
+ }
112
+ headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
113
+
114
+ with httpx.Client(timeout=httpx.Timeout(10.0)) as client:
115
+ resp = client.post(url, headers=headers, json=payload)
116
+ return resp.status_code == 200
117
+ except:
118
+ return False
119
+
120
+
121
  def call_chat_completions(
122
  model: str,
123
  messages: list,
 
374
  img_b64 = base64.b64encode(buffered.getvalue()).decode("utf-8")
375
 
376
  prompt = (
377
+ "Analyze this image in detail for website recreation. Provide:\n"
378
+ "1. Layout structure with specific measurements and grid systems\n"
379
+ "2. Exact color values (hex codes) for all elements\n"
380
+ "3. Typography details including font families, sizes, weights\n"
381
+ "4. All UI components and their states (hover, active, disabled)\n"
382
+ "5. Content organization and hierarchy\n"
383
+ "6. Image and icon placements with approximate dimensions\n"
384
+ "7. Spacing, padding, margins in pixels or rem units\n"
385
+ "8. Interactive elements and animations\n"
386
+ "9. Responsive breakpoints if evident\n"
387
+ "10. Special effects like shadows, gradients, borders\n"
388
+ "Be extremely specific about every visual detail."
 
389
  )
390
 
391
  messages = [
 
403
  model=vision_model,
404
  messages=messages,
405
  api_key=api_key,
406
+ max_tokens=2500,
407
  temperature=0.7,
408
  retry_with_fallback=True,
409
  )
 
433
  return "Error: Nebius API key not provided."
434
 
435
  prompt = f"""
436
+ You are an expert web developer. Create a pixel-perfect, single-file HTML webpage based on this description:
437
 
438
  {description}
439
 
440
+ STRICT REQUIREMENTS:
441
+ 1. ONE SINGLE HTML file - no external files except CDNs
442
+ 2. ALL CSS must be in <style> tags in the <head>
443
+ 3. ALL JavaScript must be in <script> tags before </body>
444
+ 4. Include TailwindCSS: <script src="https://cdn.tailwindcss.com"></script>
445
+ 5. Use both Tailwind utilities and custom CSS for perfect styling
446
+ 6. Fully responsive design (mobile, tablet, desktop)
447
+ 7. Use placeholder images: https://picsum.photos/WIDTH/HEIGHT
448
+ 8. Add smooth animations and transitions
449
+ 9. Include ALL interactive functionality with JavaScript
450
+ 10. Semantic HTML5 with proper accessibility
451
+ 11. Modern CSS features (grid, flexbox, custom properties)
452
+ 12. Professional design with attention to detail
453
+ 13. Match the description EXACTLY
 
 
 
454
 
455
  OUTPUT FORMAT:
456
+ Start with: <!DOCTYPE html>
457
+ End with: </html>
458
+ NO explanations, NO markdown, ONLY HTML code.
 
 
459
 
460
+ Make it production-ready and visually impressive.
461
  """.strip()
462
 
463
  try:
 
494
  except Exception as e:
495
  error_msg = str(e)
496
  if "404" in error_msg or "not found" in error_msg.lower():
497
+ # Provide working alternatives
498
+ working_models = ["Qwen/Qwen2.5-7B-Instruct", "Qwen/Qwen2.5-14B-Instruct", "deepseek-ai/DeepSeek-V3"]
499
+ return f"Error: Model '{code_model}' not available. Working alternatives: {', '.join(working_models)}"
500
  if "timeout" in error_msg.lower():
501
  return f"Error: Request timed out. Try reducing max tokens or using: {', '.join(MODEL_RECOMMENDATIONS['fast'])}"
502
  return f"Error generating HTML code: {error_msg}"
 
630
  THEME_MUTED = "#6B7280"
631
  THEME_BORDER = "#E5E7EB"
632
  THEME_SUCCESS = "#10B981"
633
+ THEME_WARNING = "#F59E0B"
634
  THEME_GRADIENT = f"linear-gradient(135deg, {THEME_PRIMARY} 0%, {THEME_SECONDARY} 100%)"
635
 
636
  custom_css = f"""
 
643
  --muted: {THEME_MUTED};
644
  --border: {THEME_BORDER};
645
  --success: {THEME_SUCCESS};
646
+ --warning: {THEME_WARNING};
647
  }}
648
 
649
  body {{
 
711
  box-shadow: 0 0 0 3px rgba(108,92,231,0.15) !important;
712
  }}
713
 
714
+ .model-count {{
715
+ background: {THEME_GRADIENT};
716
+ color: white;
717
+ padding: 4px 12px;
718
+ border-radius: 20px;
719
+ font-weight: 600;
720
+ display: inline-block;
721
+ margin: 8px 4px;
722
+ }}
723
+
724
+ .verified-badge {{
725
  background: var(--success);
726
  color: white;
727
  padding: 2px 8px;
728
  border-radius: 4px;
729
+ font-size: 11px;
730
  font-weight: 600;
731
  display: inline-block;
732
  margin-left: 8px;
733
  }}
734
 
735
+ .model-size {{
736
+ background: var(--warning);
737
  color: white;
738
+ padding: 2px 6px;
739
+ border-radius: 4px;
740
+ font-size: 10px;
741
  font-weight: 600;
742
  display: inline-block;
743
+ margin-left: 4px;
744
  }}
745
  """
746
 
 
752
  gr.Markdown(
753
  """
754
  # AI Website Generator (Nebius)
755
+ Transform website screenshots into functional HTML code using verified Nebius AI models.
756
 
757
  ### Key Features:
758
+ - Vision Analysis with Qwen VL models
759
+ - Code Generation with 14 verified working models
760
  - Single-file HTML output with inline CSS
761
  - Direct CodeSandbox deployment
762
+ - Automatic fallback for reliability
763
  """,
764
  elem_classes=["title"],
765
  )
 
768
  gr.Markdown(
769
  f"""
770
  Configure your API settings and model preferences.
771
+ <span class="model-count">{len(CODE_MODELS)} Code Models</span>
772
+ <span class="model-count">{len(VISION_MODELS)} Vision Models</span>
773
+ <span class="verified-badge">All Verified Working</span>
774
  """,
775
  elem_classes=["muted"]
776
  )
 
787
  label="Vision Model",
788
  choices=VISION_MODELS,
789
  value=DEFAULT_VISION_MODEL,
790
+ allow_custom_value=False,
791
  info="Qwen VL models for image analysis",
792
  )
793
  code_model_dd = gr.Dropdown(
794
  label="Code Model",
795
  choices=CODE_MODELS,
796
  value=DEFAULT_CODE_MODEL,
797
+ allow_custom_value=False,
798
+ info="All models verified and working",
799
  )
800
 
801
  with gr.Row():
 
813
  maximum=1.0,
814
  step=0.1,
815
  value=0.7,
816
+ info="Creativity level (0.7 recommended)",
817
  )
818
 
819
  # Quick model selection buttons
820
+ gr.Markdown("**Quick Select by Performance:**")
821
  with gr.Row():
822
+ fast_btn = gr.Button("Ultra Fast (0.5B-3B)", size="sm", elem_classes=["secondary-btn"])
823
+ balanced_btn = gr.Button("Balanced (14B-32B)", size="sm", elem_classes=["secondary-btn"])
824
+ quality_btn = gr.Button("Maximum Quality (72B)", size="sm", elem_classes=["secondary-btn"])
825
+ code_spec_btn = gr.Button("Code Optimized", size="sm", elem_classes=["secondary-btn"])
826
 
827
  def set_fast_models():
828
  return MODEL_RECOMMENDATIONS["fast"][0]
 
854
 
855
  gr.Markdown(
856
  """
857
+ **Tips:**
858
+ - Clear, high-resolution screenshots work best
859
+ - Include the full page or section
860
+ - Complex layouts may need higher token limits
861
  """,
862
  elem_classes=["muted"]
863
  )
 
916
  f"""
917
  ## Verified Working Models on Nebius
918
 
919
+ All models listed here have been tested and confirmed to work with the Nebius API.
920
 
921
  ### Vision Models ({len(VISION_MODELS)} models)
922
+ - **Qwen/Qwen2.5-VL-72B-Instruct** <span class="model-size">72B</span> - Highest quality vision analysis
923
+ - **Qwen/Qwen2.5-VL-7B-Instruct** <span class="model-size">7B</span> - Fast vision processing
 
 
924
 
925
  ### Code Generation Models ({len(CODE_MODELS)} models)
926
 
927
+ #### Qwen 2.5 Series (Latest Generation)
928
+ - **Qwen/Qwen2.5-72B-Instruct** <span class="model-size">72B</span> - Flagship model, best quality
929
+ - **Qwen/Qwen2.5-Coder-32B-Instruct** <span class="model-size">32B</span> - Optimized for code generation
930
+ - **Qwen/Qwen2.5-32B-Instruct** <span class="model-size">32B</span> - Balanced performance
931
+ - **Qwen/Qwen2.5-14B-Instruct** <span class="model-size">14B</span> - Good balance of speed and quality
932
+ - **Qwen/Qwen2.5-7B-Instruct** <span class="model-size">7B</span> - Fast generation
933
+ - **Qwen/Qwen2.5-3B-Instruct** <span class="model-size">3B</span> - Very fast
934
+ - **Qwen/Qwen2.5-1.5B-Instruct** <span class="model-size">1.5B</span> - Ultra fast
935
+ - **Qwen/Qwen2.5-0.5B-Instruct** <span class="model-size">0.5B</span> - Fastest option
936
+
937
+ #### Specialized Models
938
+ - **Qwen/QwQ-32B-Preview** <span class="model-size">32B</span> - Advanced reasoning capabilities
939
+ - **deepseek-ai/DeepSeek-V3** <span class="model-size">Large</span> - State-of-the-art code generation
940
 
941
+ #### DeepSeek R1 Distilled Models
942
+ - **deepseek-ai/DeepSeek-R1-Distill-Qwen-32B** <span class="model-size">32B</span> - High quality distillation
943
+ - **deepseek-ai/DeepSeek-R1-Distill-Qwen-14B** <span class="model-size">14B</span> - Balanced distillation
944
+ - **deepseek-ai/DeepSeek-R1-Distill-Qwen-7B** <span class="model-size">7B</span> - Fast distillation
945
+ - **deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B** <span class="model-size">1.5B</span> - Ultra fast distillation
 
 
 
 
946
 
947
+ ### Performance Guide
 
 
 
 
 
948
 
949
+ | Use Case | Recommended Models | Token Limit |
950
+ |----------|-------------------|-------------|
951
+ | Quick Prototypes | 0.5B-3B models | 2000-3000 |
952
+ | Production Code | 14B-32B models | 3000-4000 |
953
+ | Complex Projects | 72B models | 4000-6000 |
954
+ | Code Optimization | Coder/DeepSeek models | 3000-5000 |
955
 
956
+ ### Status: <span class="verified-badge">All Models Active</span>
957
+ Last verified: 2025-01-21
 
 
958
  """,
959
  elem_classes=["section"]
960
  )
 
962
  gr.Markdown(
963
  """
964
  ---
965
+ Powered by Nebius AI Studio | Built with Gradio | User: samsnata
966
  """,
967
  elem_classes=["footer"]
968
  )