SHAMIL SHAHBAZ AWAN commited on
Commit
a12b3cb
·
verified ·
1 Parent(s): 89b1338

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -34
app.py CHANGED
@@ -38,7 +38,7 @@ def respond(
38
  yield response
39
 
40
 
41
- # Gradio Interface with UI Enhancements and Effects
42
  with gr.Blocks(theme="soft") as demo:
43
  gr.HTML(
44
  """
@@ -63,8 +63,8 @@ with gr.Blocks(theme="soft") as demo:
63
  label="System message",
64
  lines=2,
65
  max_lines=3,
66
- interactive=True,
67
- elem_id="system_message_box",
68
  ),
69
  gr.Slider(
70
  minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"
@@ -73,32 +73,16 @@ with gr.Blocks(theme="soft") as demo:
73
  minimum=0.1,
74
  maximum=4.0,
75
  value=0.7,
76
- step=0.1,
77
- label="Temperature",
78
  ),
79
  gr.Slider(
80
  minimum=0.1,
81
  maximum=1.0,
82
  value=0.95,
83
- step=0.05,
84
- label="Top-p (nucleus sampling)",
85
  ),
86
  ],
87
  )
88
- with gr.Column(scale=1):
89
- gr.HTML(
90
- """
91
- <div style="background: #eaf4f4; padding: 15px; border-radius: 10px;
92
- box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1); animation: slideIn 1.5s;">
93
- <h3 style="color: #2c7873;">Tips for Better Interaction:</h3>
94
- <ul style="font-size: 14px; color: #4a4a4a;">
95
- <li>Provide clear and concise messages for optimal responses.</li>
96
- <li>Adjust the <strong>Temperature</strong> for more creative or focused answers.</li>
97
- <li>Use <strong>Top-p</strong> for better control over randomness in responses.</li>
98
- </ul>
99
- </div>
100
- """
101
- )
102
 
103
  # Styling the background and adding animations
104
  demo.css = """
@@ -107,11 +91,6 @@ with gr.Blocks(theme="soft") as demo:
107
  100% { opacity: 1; }
108
  }
109
 
110
- @keyframes slideIn {
111
- 0% { transform: translateX(-50px); opacity: 0; }
112
- 100% { transform: translateX(0); opacity: 1; }
113
- }
114
-
115
  body {
116
  background: linear-gradient(120deg, #f9fafb, #dfe8f0);
117
  font-family: Arial, sans-serif;
@@ -126,14 +105,6 @@ with gr.Blocks(theme="soft") as demo:
126
  transform: scale(1.02);
127
  border-color: #6fc3df;
128
  }
129
- #system_message_box {
130
- border: 2px dashed #4a90e2;
131
- background-color: #f0f9ff;
132
- transition: background-color 0.3s ease;
133
- }
134
- #system_message_box:hover {
135
- background-color: #eaf6ff;
136
- }
137
  .gr-slider {
138
  background-color: #e9f7fc;
139
  box-shadow: inset 0px 2px 4px rgba(0, 0, 0, 0.1);
 
38
  yield response
39
 
40
 
41
+ # Gradio Interface
42
  with gr.Blocks(theme="soft") as demo:
43
  gr.HTML(
44
  """
 
63
  label="System message",
64
  lines=2,
65
  max_lines=3,
66
+ visible=False, # Hide the system message from the display
67
+ interactive=False, # Ensure the user cannot interact with it
68
  ),
69
  gr.Slider(
70
  minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"
 
73
  minimum=0.1,
74
  maximum=4.0,
75
  value=0.7,
76
+ step=0.1, label="Temperature",
 
77
  ),
78
  gr.Slider(
79
  minimum=0.1,
80
  maximum=1.0,
81
  value=0.95,
82
+ step=0.05, label="Top-p (nucleus sampling)",
 
83
  ),
84
  ],
85
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  # Styling the background and adding animations
88
  demo.css = """
 
91
  100% { opacity: 1; }
92
  }
93
 
 
 
 
 
 
94
  body {
95
  background: linear-gradient(120deg, #f9fafb, #dfe8f0);
96
  font-family: Arial, sans-serif;
 
105
  transform: scale(1.02);
106
  border-color: #6fc3df;
107
  }
 
 
 
 
 
 
 
 
108
  .gr-slider {
109
  background-color: #e9f7fc;
110
  box-shadow: inset 0px 2px 4px rgba(0, 0, 0, 0.1);