kangxiaojiang commited on
Commit
fecfaaa
·
verified ·
1 Parent(s): e8e583e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -2,7 +2,10 @@ import gradio as gr
2
  import time
3
 
4
  def patsnap_assistant(domain, query):
5
- # Simulating the process of an AI Agent calling PatSnap Skills
 
 
 
6
  yield f"🔍 Initializing PatSnap {domain} Engine...", ""
7
  time.sleep(1)
8
 
@@ -43,13 +46,14 @@ def patsnap_assistant(domain, query):
43
  """
44
  yield "✅ Analysis Complete!", result
45
 
46
- # Custom CSS for PatSnap branding
47
  custom_css = """
48
- .gradio-container { background-color: #f8f9fa; }
49
  #title { text-align: center; color: #1a73e8; margin-bottom: 20px; }
 
50
  """
51
 
52
- with gr.Blocks(css=custom_css, title="PatSnap Intelligence Assistant") as demo:
 
53
  gr.Markdown("# 🧬 PatSnap Intelligence Assistant", elem_id="title")
54
  gr.Markdown("Experience the power of PatSnap AI Agent Skills. Select a domain and enter your keywords.")
55
 
@@ -67,7 +71,8 @@ with gr.Blocks(css=custom_css, title="PatSnap Intelligence Assistant") as demo:
67
  submit_btn = gr.Button("Start Intelligence Analysis", variant="primary")
68
 
69
  with gr.Column(scale=2):
70
- status_output = gr.Markdown("Waiting for input...")
 
71
  result_output = gr.Markdown("Analysis results will appear here.")
72
 
73
  submit_btn.click(
 
2
  import time
3
 
4
  def patsnap_assistant(domain, query):
5
+ if not query:
6
+ yield "⚠️ Please enter keywords first.", ""
7
+ return
8
+
9
  yield f"🔍 Initializing PatSnap {domain} Engine...", ""
10
  time.sleep(1)
11
 
 
46
  """
47
  yield "✅ Analysis Complete!", result
48
 
49
+ # Optimized CSS: Removed fixed background to support Dark Mode
50
  custom_css = """
 
51
  #title { text-align: center; color: #1a73e8; margin-bottom: 20px; }
52
+ .feedback { font-weight: bold; color: #1a73e8; }
53
  """
54
 
55
+ # Using gr.Themes.Soft() for a more professional look that adapts to Dark/Light mode
56
+ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="PatSnap Intelligence Assistant") as demo:
57
  gr.Markdown("# 🧬 PatSnap Intelligence Assistant", elem_id="title")
58
  gr.Markdown("Experience the power of PatSnap AI Agent Skills. Select a domain and enter your keywords.")
59
 
 
71
  submit_btn = gr.Button("Start Intelligence Analysis", variant="primary")
72
 
73
  with gr.Column(scale=2):
74
+ # Added a clear container for status and results
75
+ status_output = gr.Markdown("Waiting for input...", elem_classes="feedback")
76
  result_output = gr.Markdown("Analysis results will appear here.")
77
 
78
  submit_btn.click(