Spaces:
Sleeping
Sleeping
Commit ·
44a460d
1
Parent(s): abd5040
fix
Browse files- .dockerignore +17 -0
- .streamlit/config.toml +9 -1
- Dockerfile +7 -0
- audio_processor.py +2 -3
- translator.py +1 -2
.dockerignore
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__
|
| 2 |
+
*.pyc
|
| 3 |
+
*.pyo
|
| 4 |
+
*.pyd
|
| 5 |
+
.Python
|
| 6 |
+
.git
|
| 7 |
+
.gitignore
|
| 8 |
+
README.md
|
| 9 |
+
README_AR.md
|
| 10 |
+
.pytest_cache
|
| 11 |
+
.vscode
|
| 12 |
+
.env.local
|
| 13 |
+
.env.development.local
|
| 14 |
+
.env.test.local
|
| 15 |
+
.env.production.local
|
| 16 |
+
*.log
|
| 17 |
+
.DS_Store
|
.streamlit/config.toml
CHANGED
|
@@ -1,7 +1,15 @@
|
|
| 1 |
[server]
|
| 2 |
headless = true
|
| 3 |
address = "0.0.0.0"
|
| 4 |
-
port =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
[theme]
|
| 7 |
base = "light"
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
[server]
|
| 2 |
headless = true
|
| 3 |
address = "0.0.0.0"
|
| 4 |
+
port = 8501
|
| 5 |
+
enableCORS = false
|
| 6 |
+
enableXsrfProtection = false
|
| 7 |
+
|
| 8 |
+
[browser]
|
| 9 |
+
gatherUsageStats = false
|
| 10 |
|
| 11 |
[theme]
|
| 12 |
base = "light"
|
| 13 |
+
|
| 14 |
+
[global]
|
| 15 |
+
dataFrameSerialization = "legacy"
|
Dockerfile
CHANGED
|
@@ -24,6 +24,13 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 24 |
# Copy the entire app
|
| 25 |
COPY . .
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
# Expose the port that Streamlit runs on
|
| 28 |
EXPOSE 8501
|
| 29 |
|
|
|
|
| 24 |
# Copy the entire app
|
| 25 |
COPY . .
|
| 26 |
|
| 27 |
+
# Create .streamlit directory and set permissions
|
| 28 |
+
RUN mkdir -p /app/.streamlit && \
|
| 29 |
+
chmod -R 755 /app/.streamlit
|
| 30 |
+
|
| 31 |
+
# Set environment variable for Streamlit config
|
| 32 |
+
ENV STREAMLIT_CONFIG_DIR=/app/.streamlit
|
| 33 |
+
|
| 34 |
# Expose the port that Streamlit runs on
|
| 35 |
EXPOSE 8501
|
| 36 |
|
audio_processor.py
CHANGED
|
@@ -15,8 +15,7 @@ os.environ["NUMBA_CACHE_DIR"] = "/tmp"
|
|
| 15 |
import librosa
|
| 16 |
# --- END OF FIX ---
|
| 17 |
|
| 18 |
-
|
| 19 |
-
from google.genai import types
|
| 20 |
from translator import AITranslator
|
| 21 |
|
| 22 |
class AudioProcessor:
|
|
@@ -69,7 +68,7 @@ class AudioProcessor:
|
|
| 69 |
|
| 70 |
response = self.client.models.generate_content(
|
| 71 |
model="gemini-2.5-flash",
|
| 72 |
-
contents=[
|
| 73 |
)
|
| 74 |
|
| 75 |
if response and response.text:
|
|
|
|
| 15 |
import librosa
|
| 16 |
# --- END OF FIX ---
|
| 17 |
|
| 18 |
+
import google.generativeai as genai
|
|
|
|
| 19 |
from translator import AITranslator
|
| 20 |
|
| 21 |
class AudioProcessor:
|
|
|
|
| 68 |
|
| 69 |
response = self.client.models.generate_content(
|
| 70 |
model="gemini-2.5-flash",
|
| 71 |
+
contents=[genai.Part.from_bytes(data=audio_bytes, mime_type=mime_type), "Transcribe this audio."]
|
| 72 |
)
|
| 73 |
|
| 74 |
if response and response.text:
|
translator.py
CHANGED
|
@@ -5,8 +5,7 @@ from dotenv import load_dotenv
|
|
| 5 |
import json
|
| 6 |
import traceback
|
| 7 |
from typing import Dict, List, Optional, Tuple
|
| 8 |
-
|
| 9 |
-
from google.genai import types
|
| 10 |
|
| 11 |
class AITranslator:
|
| 12 |
"""
|
|
|
|
| 5 |
import json
|
| 6 |
import traceback
|
| 7 |
from typing import Dict, List, Optional, Tuple
|
| 8 |
+
import google.generativeai as genai
|
|
|
|
| 9 |
|
| 10 |
class AITranslator:
|
| 11 |
"""
|