Update app.py
Browse files
app.py
CHANGED
|
@@ -19,6 +19,22 @@ import logging
|
|
| 19 |
from textblob import TextBlob
|
| 20 |
import whisper
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
# Configure logging
|
| 24 |
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s")
|
|
@@ -197,12 +213,22 @@ def build_interface():
|
|
| 197 |
translated_output = gr.JSON(label="Video transcript")
|
| 198 |
processed_video_output = gr.File(label="Download Processed Video", interactive=False) # Download button
|
| 199 |
with gr.Row():
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
|
| 207 |
# with gr.Tab("Analytics Dashboard"):
|
| 208 |
# gr.Markdown("## Content Performance Analytics")
|
|
|
|
| 19 |
from textblob import TextBlob
|
| 20 |
import whisper
|
| 21 |
|
| 22 |
+
import sqlite3
|
| 23 |
+
|
| 24 |
+
# Initialize SQLite database
|
| 25 |
+
conn = sqlite3.connect("feedback.db")
|
| 26 |
+
cursor = conn.cursor()
|
| 27 |
+
cursor.execute("CREATE TABLE IF NOT EXISTS feedback (id INTEGER PRIMARY KEY, comment TEXT)")
|
| 28 |
+
conn.commit()
|
| 29 |
+
|
| 30 |
+
# Function to save feedback to the database
|
| 31 |
+
def save_feedback_db(feedback):
|
| 32 |
+
if feedback.strip(): # Ensure feedback is not empty
|
| 33 |
+
cursor.execute("INSERT INTO feedback (comment) VALUES (?)", (feedback,))
|
| 34 |
+
conn.commit()
|
| 35 |
+
return "Thank you for your feedback!"
|
| 36 |
+
else:
|
| 37 |
+
return "Feedback cannot be empty."
|
| 38 |
|
| 39 |
# Configure logging
|
| 40 |
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s")
|
|
|
|
| 213 |
translated_output = gr.JSON(label="Video transcript")
|
| 214 |
processed_video_output = gr.File(label="Download Processed Video", interactive=False) # Download button
|
| 215 |
with gr.Row():
|
| 216 |
+
gr.Markdown("## Provide Your Feedback")
|
| 217 |
+
feedback_input = gr.Textbox(label="Your Feedback", placeholder="Enter your feedback here...", lines=3)
|
| 218 |
+
feedback_btn = gr.Button("Submit Feedback")
|
| 219 |
+
result_output = gr.Textbox(label="Submission Status", interactive=False)
|
| 220 |
+
|
| 221 |
+
submit_button.click(
|
| 222 |
+
upload_and_manage,
|
| 223 |
+
inputs=[file_input, language_input],
|
| 224 |
+
outputs=[translated_output, processed_video_output]
|
| 225 |
+
)
|
| 226 |
+
# Connect submit button to save_feedback_db function
|
| 227 |
+
feedback_btn.click(
|
| 228 |
+
save_feedback_db,
|
| 229 |
+
inputs=[feedback_input],
|
| 230 |
+
outputs=[result_output]
|
| 231 |
+
)
|
| 232 |
|
| 233 |
# with gr.Tab("Analytics Dashboard"):
|
| 234 |
# gr.Markdown("## Content Performance Analytics")
|