mdakhras commited on
Commit
13df89b
·
verified ·
1 Parent(s): 1f965b8

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +2 -12
src/streamlit_app.py CHANGED
@@ -1,15 +1,8 @@
1
  import streamlit as st
2
  import fitz # PyMuPDF
3
- from langchain_openai import ChatOpenAI
4
- from azure.core.credentials import AzureKeyCredential
5
  from dotenv import load_dotenv
6
  import io
7
  import os
8
- import openai
9
- import logging
10
- from langchain_core.messages import HumanMessage, SystemMessage
11
- from azure.identity import ManagedIdentityCredential # For Managed Identity
12
- from azure.core.credentials import AzureKeyCredential
13
  import requests
14
  #openAI
15
  # from langchain_openai import AzureChatOpenAI
@@ -24,17 +17,14 @@ API_KEY = os.getenv("AZURE_OPENAI_API_KEY")
24
  DEPLOYMENT_NAME = os.getenv("AZURE_OPENAI_DEPLOYMENT_NAME")
25
  azure_openai_embedding_model = os.getenv("AZURE_OPENAI_EMBEDDING_MODEL")
26
  HuggingFace_API_KEY = os.getenv("HUGGINGFACE_API_KEY")
27
- HuggingFace_API_URL = os.getenv("HUGGINGFACE_API_URL")
28
 
29
  # Check if the necessary environment variables are loaded
30
  if not API_KEY or not ENDPOINT or not DEPLOYMENT_NAME:
31
  st.error("Azure OpenAI credentials are missing. Please check your .env file.")
32
  st.stop()
33
 
34
- # Initialize the OpenAI client
35
- #client = OpenAIClient(endpoint=ENDPOINT, credential=AzureKeyCredential(API_KEY))
36
-
37
  #myCode
 
38
  headers = {
39
  "Authorization": f"Bearer {HuggingFace_API_KEY}" # Replace with your actual API key
40
  }
@@ -111,4 +101,4 @@ if uploaded_file is not None:
111
 
112
  # Display the extracted information
113
  st.subheader("Extracted Information")
114
- st.write(extracted_info)
 
1
  import streamlit as st
2
  import fitz # PyMuPDF
 
 
3
  from dotenv import load_dotenv
4
  import io
5
  import os
 
 
 
 
 
6
  import requests
7
  #openAI
8
  # from langchain_openai import AzureChatOpenAI
 
17
  DEPLOYMENT_NAME = os.getenv("AZURE_OPENAI_DEPLOYMENT_NAME")
18
  azure_openai_embedding_model = os.getenv("AZURE_OPENAI_EMBEDDING_MODEL")
19
  HuggingFace_API_KEY = os.getenv("HUGGINGFACE_API_KEY")
 
20
 
21
  # Check if the necessary environment variables are loaded
22
  if not API_KEY or not ENDPOINT or not DEPLOYMENT_NAME:
23
  st.error("Azure OpenAI credentials are missing. Please check your .env file.")
24
  st.stop()
25
 
 
 
 
26
  #myCode
27
+ API_URL = "https://api-inference.huggingface.co/models/gpt2" # Replace with your desired model's API URL
28
  headers = {
29
  "Authorization": f"Bearer {HuggingFace_API_KEY}" # Replace with your actual API key
30
  }
 
101
 
102
  # Display the extracted information
103
  st.subheader("Extracted Information")
104
+ st.write(extracted_info)