root commited on
Commit
ab4f707
·
1 Parent(s): 9883b85

add requirements

Browse files
Files changed (2) hide show
  1. app.py +2 -4
  2. requirements.txt +6 -0
app.py CHANGED
@@ -11,8 +11,6 @@ import gradio as gr
11
  # Config
12
  # =========================
13
  DEFAULT_API_URL = os.environ.get("API_URL")
14
- if DEFAULT_API_URL and not DEFAULT_API_URL.endswith("/layout-parsing"):
15
- DEFAULT_API_URL = DEFAULT_API_URL.rstrip("/") + "/layout-parsing"
16
  LOGO_IMAGE_PATH = './assets/logo.jpg'
17
  GOOGLE_FONTS_URL = "<link href='https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;700&display=swap' rel='stylesheet'>"
18
  LATEX_DELIMS = [
@@ -104,7 +102,7 @@ def _call_api(api_url: str, file_path: str, use_layout_detection: bool, prompt_l
104
  resp.raise_for_status()
105
  data = resp.json()
106
  except requests.exceptions.RequestException as e:
107
- raise gr.Error(f"API request failed:")
108
  except json.JSONDecodeError:
109
  raise gr.Error(f"Invalid JSON response from server:\n{getattr(resp, 'text', '')}")
110
  if data.get("errorCode", -1) != 0:
@@ -336,4 +334,4 @@ with gr.Blocks(head=GOOGLE_FONTS_URL, css=custom_css, theme=gr.themes.Soft()) as
336
 
337
  if __name__ == "__main__":
338
  port = int(os.getenv("PORT", "7860"))
339
- demo.queue().launch(server_name="0.0.0.0", server_port=port,share=False)
 
11
  # Config
12
  # =========================
13
  DEFAULT_API_URL = os.environ.get("API_URL")
 
 
14
  LOGO_IMAGE_PATH = './assets/logo.jpg'
15
  GOOGLE_FONTS_URL = "<link href='https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;700&display=swap' rel='stylesheet'>"
16
  LATEX_DELIMS = [
 
102
  resp.raise_for_status()
103
  data = resp.json()
104
  except requests.exceptions.RequestException as e:
105
+ raise gr.Error(f"API request failed:{e}")
106
  except json.JSONDecodeError:
107
  raise gr.Error(f"Invalid JSON response from server:\n{getattr(resp, 'text', '')}")
108
  if data.get("errorCode", -1) != 0:
 
334
 
335
  if __name__ == "__main__":
336
  port = int(os.getenv("PORT", "7860"))
337
+ demo.queue().launch(server_name="0.0.0.0", server_port=port,share=False)
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ gradio==5.42.0
2
+ gradio_client==1.11.1
3
+ huggingface-hub==0.34.4
4
+ numpy==2.3.2
5
+ pillow==11.3.0
6
+ requests==2.32.4