Patel Traders commited on
Commit
543ca49
·
verified ·
1 Parent(s): 25765fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -24
app.py CHANGED
@@ -1,6 +1,6 @@
1
- # --- हनुमान AI: जय माँ संस्करण (अजेय एवं एरर-फ्री) ---
2
  # मार्गदर्शक: दिव्य पटेल जी | भारत 🇮🇳
3
- # फिक्स: Gradio 'Div' AttributeError और 401 Unauthorized समाधान।
4
 
5
  import gradio as gr
6
  import torch
@@ -74,38 +74,37 @@ def hanuman_maa_chat_stream(message, history):
74
  partial_text = ""
75
  for new_text in streamer:
76
  partial_text += new_text
 
77
  clean_text = partial_text.replace("<think>", "*(हनुमान विचार कर रहे हैं... जय माँ!)*\n\n").replace("</think>", "\n\n---\n\n")
78
  yield clean_text
79
 
80
- # --- दिव्य भगवा थीम (AttributeError Fix) ---
81
- custom_css = """
82
- .gradio-container { background-color: #fffaf0 !important; border: none !important; }
 
83
  .bhagwa-header {
84
- background: linear-gradient(135deg, #ff8833, #b33c00) !important;
85
- padding: 30px !important; border-radius: 25px !important; color: white !important;
86
- text-align: center !important; box-shadow: 0 15px 35px rgba(179, 60, 0, 0.4) !important;
87
- margin-bottom: 25px !important;
88
  }
89
- .message.user { background: #ff9933 !important; color: white !important; border-radius: 20px 20px 0 20px !important; }
90
- .message.bot { border-left: 6px solid #ff5500 !important; background: white !important; border-radius: 20px 20px 20px 0 !important; }
91
- footer { display: none !important; }
 
 
 
 
92
  """
93
 
94
- with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
95
- # यहाँ gr.Div की जगह gr.HTML का उपयोग किया गया है जो अधिक स्थिर है
96
- gr.HTML("""
97
- <div class="bhagwa-header">
98
- <h1>🔱 हनुमान AI - जय माँ संस्करण</h1>
99
- <p>Pioneered by Divy Patel | स्वतंत्र एवं अजेय स्वदेशी तकनीक</p>
100
- </div>
101
- """)
102
 
 
103
  gr.ChatInterface(
104
  fn=hanuman_maa_chat_stream,
105
- fill_height=True,
106
- retry_btn=None,
107
- undo_btn=None,
108
- clear_btn="🗑️ इतिहास मिटाएँ",
109
  )
110
 
111
  if __name__ == "__main__":
 
1
+ # --- हनुमान AI: जय माँ संस्करण (Gradio 6.0 अजेय फिक) ---
2
  # मार्गदर्शक: दिव्य पटेल जी | भारत 🇮🇳
3
+ # फिक्स: ChatInterface TypeError और CSS Warning का पूर्ण समाधान।
4
 
5
  import gradio as gr
6
  import torch
 
74
  partial_text = ""
75
  for new_text in streamer:
76
  partial_text += new_text
77
+ # थिंकिंग प्रोसेस को दिव्य रूप में दर्शाना
78
  clean_text = partial_text.replace("<think>", "*(हनुमान विचार कर रहे हैं... जय माँ!)*\n\n").replace("</think>", "\n\n---\n\n")
79
  yield clean_text
80
 
81
+ # --- दिव्य भगवा थीम (HTML + CSS) नए Gradio 6.0 के अनुकूल ---
82
+ divine_ui = """
83
+ <style>
84
+ .gradio-container { background-color: #fffaf0 !important; }
85
  .bhagwa-header {
86
+ background: linear-gradient(135deg, #ff8833, #b33c00);
87
+ padding: 30px; border-radius: 25px; color: white;
88
+ text-align: center; box-shadow: 0 15px 35px rgba(179, 60, 0, 0.4);
89
+ margin-bottom: 25px;
90
  }
91
+ .bhagwa-header h1 { font-size: 34px !important; font-weight: 900 !important; margin-bottom: 5px; }
92
+ .bhagwa-header p { font-size: 16px !important; opacity: 0.9; }
93
+ </style>
94
+ <div class="bhagwa-header">
95
+ <h1>🔱 हनुमान AI - जय माँ संस्करण</h1>
96
+ <p>Pioneered by Divy Patel | स्वतंत्र एवं अजेय स्वदेशी तकनीक</p>
97
+ </div>
98
  """
99
 
100
+ # यहाँ से css और theme हटा दिए गए हैं ताकि Warning न आए
101
+ with gr.Blocks() as demo:
102
+ gr.HTML(divine_ui)
 
 
 
 
 
103
 
104
+ # यहाँ से पुराने बटन हटा दिए गए हैं ताकि TypeError न आए
105
  gr.ChatInterface(
106
  fn=hanuman_maa_chat_stream,
107
+ fill_height=True
 
 
 
108
  )
109
 
110
  if __name__ == "__main__":