Update app.py
Browse files
app.py
CHANGED
|
@@ -21,17 +21,15 @@ 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 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
return "Thank you for your feedback!"
|
| 36 |
else:
|
| 37 |
return "Feedback cannot be empty."
|
|
@@ -203,20 +201,21 @@ def build_interface():
|
|
| 203 |
# with gr.Tab("Content Management"):
|
| 204 |
gr.Markdown("## Video Localization")
|
| 205 |
with gr.Row():
|
|
|
|
|
|
|
| 206 |
file_input = gr.File(label="Upload Video/Audio File")
|
| 207 |
# platform_input = gr.Dropdown(["YouTube", "Instagram"], label="Select Platform")
|
| 208 |
language_input = gr.Dropdown(["en", "es", "fr", "zh"], label="Select Language") # Language codes
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 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,
|
|
|
|
| 21 |
|
| 22 |
import sqlite3
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
# Function to save feedback to the database
|
| 25 |
def save_feedback_db(feedback):
|
| 26 |
if feedback.strip(): # Ensure feedback is not empty
|
| 27 |
+
# Create a new connection for the current thread
|
| 28 |
+
with sqlite3.connect("feedback.db") as conn:
|
| 29 |
+
cursor = conn.cursor()
|
| 30 |
+
cursor.execute("CREATE TABLE IF NOT EXISTS feedback (id INTEGER PRIMARY KEY, comment TEXT)")
|
| 31 |
+
cursor.execute("INSERT INTO feedback (comment) VALUES (?)", (feedback,))
|
| 32 |
+
conn.commit()
|
| 33 |
return "Thank you for your feedback!"
|
| 34 |
else:
|
| 35 |
return "Feedback cannot be empty."
|
|
|
|
| 201 |
# with gr.Tab("Content Management"):
|
| 202 |
gr.Markdown("## Video Localization")
|
| 203 |
with gr.Row():
|
| 204 |
+
with gr.Column():
|
| 205 |
+
|
| 206 |
file_input = gr.File(label="Upload Video/Audio File")
|
| 207 |
# platform_input = gr.Dropdown(["YouTube", "Instagram"], label="Select Platform")
|
| 208 |
language_input = gr.Dropdown(["en", "es", "fr", "zh"], label="Select Language") # Language codes
|
| 209 |
+
submit_button = gr.Button("Post and Process")
|
| 210 |
+
with gr.Column():
|
| 211 |
+
# post_output = gr.Textbox(label="Posting Status", interactive=False)
|
| 212 |
+
translated_output = gr.JSON(label="Video transcript")
|
| 213 |
+
processed_video_output = gr.File(label="Download Processed Video", interactive=False) # Download button
|
|
|
|
| 214 |
with gr.Row():
|
| 215 |
gr.Markdown("## Provide Your Feedback")
|
| 216 |
feedback_input = gr.Textbox(label="Your Feedback", placeholder="Enter your feedback here...", lines=3)
|
| 217 |
feedback_btn = gr.Button("Submit Feedback")
|
| 218 |
+
result_output = gr.Textbox(label="Submission Status", interactive=False, visible=False)
|
| 219 |
|
| 220 |
submit_button.click(
|
| 221 |
upload_and_manage,
|