Update app.py
Browse files
app.py
CHANGED
|
@@ -19,7 +19,7 @@ from bs4 import BeautifulSoup
|
|
| 19 |
from collections import deque
|
| 20 |
from datetime import datetime
|
| 21 |
from dotenv import load_dotenv
|
| 22 |
-
from gradio_client import Client
|
| 23 |
from huggingface_hub import InferenceClient
|
| 24 |
from io import BytesIO
|
| 25 |
from moviepy.editor import VideoFileClip
|
|
@@ -32,8 +32,6 @@ from xml.etree import ElementTree as ET
|
|
| 32 |
import openai
|
| 33 |
from openai import OpenAI
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
# 1. Configuration
|
| 38 |
Site_Name = 'Scholarly-Article-Document-Search-With-Memory'
|
| 39 |
title="🔬🧠ScienceBrain.AI"
|
|
@@ -1847,12 +1845,22 @@ def transcribe_canary(filename):
|
|
| 1847 |
st.write(result)
|
| 1848 |
return result
|
| 1849 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1850 |
|
| 1851 |
# Transcript to arxiv and client chat completion ------------------------- !!
|
| 1852 |
filename = save_and_play_audio(audio_recorder)
|
| 1853 |
if filename is not None:
|
| 1854 |
transcript=''
|
| 1855 |
-
transcript=
|
|
|
|
| 1856 |
|
| 1857 |
# Search ArXiV and get the Summary and Reference Papers Listing
|
| 1858 |
result = search_arxiv(transcript)
|
|
|
|
| 19 |
from collections import deque
|
| 20 |
from datetime import datetime
|
| 21 |
from dotenv import load_dotenv
|
| 22 |
+
from gradio_client import Client, handle_file
|
| 23 |
from huggingface_hub import InferenceClient
|
| 24 |
from io import BytesIO
|
| 25 |
from moviepy.editor import VideoFileClip
|
|
|
|
| 32 |
import openai
|
| 33 |
from openai import OpenAI
|
| 34 |
|
|
|
|
|
|
|
| 35 |
# 1. Configuration
|
| 36 |
Site_Name = 'Scholarly-Article-Document-Search-With-Memory'
|
| 37 |
title="🔬🧠ScienceBrain.AI"
|
|
|
|
| 1845 |
st.write(result)
|
| 1846 |
return result
|
| 1847 |
|
| 1848 |
+
def transcribe_whisperLTurbo(filename):
|
| 1849 |
+
client = Client("hf-audio/whisper-large-v3-turbo")
|
| 1850 |
+
result = client.predict(
|
| 1851 |
+
inputs=handle_file('https://github.com/gradio-app/gradio/raw/main/test/test_files/audio_sample.wav'),
|
| 1852 |
+
task="transcribe",
|
| 1853 |
+
api_name="/predict"
|
| 1854 |
+
)
|
| 1855 |
+
st.write(result)
|
| 1856 |
+
return result
|
| 1857 |
|
| 1858 |
# Transcript to arxiv and client chat completion ------------------------- !!
|
| 1859 |
filename = save_and_play_audio(audio_recorder)
|
| 1860 |
if filename is not None:
|
| 1861 |
transcript=''
|
| 1862 |
+
transcript=transcribe_whisperLTurbo(filename)
|
| 1863 |
+
#transcript=transcribe_canary(filename)
|
| 1864 |
|
| 1865 |
# Search ArXiV and get the Summary and Reference Papers Listing
|
| 1866 |
result = search_arxiv(transcript)
|