Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,9 +42,12 @@ if st.button("Generate Transcript"):
|
|
| 42 |
# Initialize GenAI client
|
| 43 |
client = genai.Client(api_key=api_key)
|
| 44 |
|
| 45 |
-
# Upload audio file
|
| 46 |
-
uploaded_file = client.files.upload(
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
| 48 |
# New token counting functionality
|
| 49 |
try:
|
| 50 |
token_info = client.models.count_tokens(
|
|
@@ -77,6 +80,8 @@ if st.button("Generate Transcript"):
|
|
| 77 |
|
| 78 |
# Credits section in sidebar
|
| 79 |
st.sidebar.markdown("""
|
|
|
|
|
|
|
| 80 |
**Credits**
|
| 81 |
- Transcription powered by [Gemini API](https://ai.google.dev/)
|
| 82 |
- Heavy inspired by https://github.com/philschmid/gemini-samples/blob/main/examples/gemini-transcribe-with-timestamps.ipynb
|
|
|
|
| 42 |
# Initialize GenAI client
|
| 43 |
client = genai.Client(api_key=api_key)
|
| 44 |
|
| 45 |
+
# Upload audio file with explicit MIME type
|
| 46 |
+
uploaded_file = client.files.upload(
|
| 47 |
+
file=tmp_file_path,
|
| 48 |
+
mime_type=audio_file.type # Get MIME type from uploaded file
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
# New token counting functionality
|
| 52 |
try:
|
| 53 |
token_info = client.models.count_tokens(
|
|
|
|
| 80 |
|
| 81 |
# Credits section in sidebar
|
| 82 |
st.sidebar.markdown("""
|
| 83 |
+
**Info**
|
| 84 |
+
- It works without key, but has limits. Use your own to upload bigger files.
|
| 85 |
**Credits**
|
| 86 |
- Transcription powered by [Gemini API](https://ai.google.dev/)
|
| 87 |
- Heavy inspired by https://github.com/philschmid/gemini-samples/blob/main/examples/gemini-transcribe-with-timestamps.ipynb
|