Spaces:
Configuration error
Configuration error
aasherkamal216
commited on
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from streamlit_vertical_slider import vertical_slider
|
| 3 |
-
import pdfplumber
|
| 4 |
from langchain_core.prompts import ChatPromptTemplate
|
| 5 |
import speech_recognition as sr
|
| 6 |
import tempfile
|
|
@@ -58,14 +57,6 @@ def temperature_slider():
|
|
| 58 |
return temperature
|
| 59 |
|
| 60 |
|
| 61 |
-
def extract_all_pages_as_images(file_upload):
|
| 62 |
-
pdf_pages = []
|
| 63 |
-
with pdfplumber.open(file_upload) as pdf:
|
| 64 |
-
pdf_pages = [page.to_image().original for page in pdf.pages]
|
| 65 |
-
|
| 66 |
-
return pdf_pages
|
| 67 |
-
|
| 68 |
-
|
| 69 |
def set_safety_settings():
|
| 70 |
safety_settings = [
|
| 71 |
{
|
|
@@ -103,4 +94,4 @@ def speech_to_text(audio_bytes):
|
|
| 103 |
except sr.UnknownValueError as e:
|
| 104 |
st.error(e)
|
| 105 |
except sr.RequestError as e:
|
| 106 |
-
print("could not request result from google speech recognition service: {0}".format(e))
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from streamlit_vertical_slider import vertical_slider
|
|
|
|
| 3 |
from langchain_core.prompts import ChatPromptTemplate
|
| 4 |
import speech_recognition as sr
|
| 5 |
import tempfile
|
|
|
|
| 57 |
return temperature
|
| 58 |
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
def set_safety_settings():
|
| 61 |
safety_settings = [
|
| 62 |
{
|
|
|
|
| 94 |
except sr.UnknownValueError as e:
|
| 95 |
st.error(e)
|
| 96 |
except sr.RequestError as e:
|
| 97 |
+
print("could not request result from google speech recognition service: {0}".format(e))
|