Sahana31 commited on
Commit
225a4a4
·
1 Parent(s): 5a090b0

added environment variable

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -1,8 +1,19 @@
 
1
  import gradio as gr
2
  import requests
3
  import mimetypes
4
 
5
- API_URL = "http://209.20.158.215:7862/v1/visual_query/?src_lang=eng_Latn&tgt_lang=kan_Knda"
 
 
 
 
 
 
 
 
 
 
6
 
7
  def ocr_from_paths(file_paths, query):
8
  results = []
 
1
+ import os
2
  import gradio as gr
3
  import requests
4
  import mimetypes
5
 
6
+ # Optional: load environment variables from a .env file (install python-dotenv if needed)
7
+ try:
8
+ from dotenv import load_dotenv
9
+ load_dotenv()
10
+ except ImportError:
11
+ pass # dotenv not installed, ignore
12
+
13
+ # Get the API URL from environment variable, provide a fallback or raise error if not set
14
+ API_URL = os.environ.get("API_URL")
15
+ if not API_URL:
16
+ raise ValueError("API_URL environment variable not set. Please set it before running the script.")
17
 
18
  def ocr_from_paths(file_paths, query):
19
  results = []