Update app.py
Browse filesApplying Piitu's edits.
app.py
CHANGED
|
@@ -86,6 +86,17 @@ def show_stars():
|
|
| 86 |
"""
|
| 87 |
return stars_html
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
# Random data for testing, actual data added later
|
| 90 |
df = pd.DataFrame({
|
| 91 |
'Year': np.random.randint(2000, 2024, 25),
|
|
@@ -116,9 +127,27 @@ with gr.Blocks(theme=theme) as demo:
|
|
| 116 |
# Keywords
|
| 117 |
keywords_output = gr.Textbox(label="Keywords")
|
| 118 |
|
| 119 |
-
|
|
|
|
| 120 |
with gr.Tab("Testing Area"):
|
| 121 |
with gr.Row():
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
|
| 124 |
demo.launch()
|
|
|
|
| 86 |
"""
|
| 87 |
return stars_html
|
| 88 |
|
| 89 |
+
# Function to handle feedback submission -Piitu
|
| 90 |
+
def handle_feedback(feedback, name):
|
| 91 |
+
return f"Thank you for your feedback, {name}!"
|
| 92 |
+
|
| 93 |
+
# Function to update placeholder text -Piitu
|
| 94 |
+
def update_placeholder(name):
|
| 95 |
+
if name:
|
| 96 |
+
return f"Enter your feedback here, {name}..."
|
| 97 |
+
else:
|
| 98 |
+
return "Enter your feedback here..."
|
| 99 |
+
|
| 100 |
# Random data for testing, actual data added later
|
| 101 |
df = pd.DataFrame({
|
| 102 |
'Year': np.random.randint(2000, 2024, 25),
|
|
|
|
| 127 |
# Keywords
|
| 128 |
keywords_output = gr.Textbox(label="Keywords")
|
| 129 |
|
| 130 |
+
|
| 131 |
+
# Testing Area -Piitu
|
| 132 |
with gr.Tab("Testing Area"):
|
| 133 |
with gr.Row():
|
| 134 |
+
name_input = gr.Textbox(label="Enter your name", placeholder="Enter your name here...")
|
| 135 |
+
|
| 136 |
+
with gr.Row():
|
| 137 |
+
text_input = gr.Textbox(label="Please give us feedback!",
|
| 138 |
+
placeholder="Enter your feedback here...",
|
| 139 |
+
max_length=5000)
|
| 140 |
+
|
| 141 |
+
# Update placeholder based on name input -Piitu
|
| 142 |
+
name_input.change(fn=update_placeholder, inputs=name_input, outputs=text_input)
|
| 143 |
+
|
| 144 |
+
# Send button -Piitu
|
| 145 |
+
send_button = gr.Button("Send")
|
| 146 |
+
|
| 147 |
+
# Output for feedback submission confirmation -Piitu
|
| 148 |
+
feedback_output = gr.Textbox(label="Submission Result", interactive=False)
|
| 149 |
+
|
| 150 |
+
# Link button to function that handles feedback submission -Piitu
|
| 151 |
+
send_button.click(handle_feedback, inputs=[text_input, name_input], outputs=feedback_output)
|
| 152 |
|
| 153 |
demo.launch()
|