fudii0921 commited on
Commit
e36d5f0
·
verified ·
1 Parent(s): 36bc034

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -177,6 +177,13 @@ def process_cohere(prompt):
177
  )
178
  return response.message.content[0].text
179
 
 
 
 
 
 
 
 
180
 
181
  def dyn_chart():
182
  # 需要曲線と供給曲線のパラメータ
@@ -455,6 +462,12 @@ with gr.Blocks(css=load_css(),js=js,title="ダイナミック・プライシン
455
  gr.Markdown("# 📄 資料")
456
 
457
  with gr.Row():
458
- pdf_output = PDF(label="資料",value="./dynamic-pricing.pdf")
 
 
 
 
 
 
459
 
460
  llm.launch(share=True,pwa=True,favicon_path="favicon.ico")
 
177
  )
178
  return response.message.content[0].text
179
 
180
+ def download_pdf():
181
+ response = requests.get("https://www.ryhintl.com/dynamic-pricing.pdf")
182
+ file_path = "dynamic-pricing.pdf"
183
+ with open(file_path, "wb") as f:
184
+ f.write(response.content)
185
+ return file_path
186
+
187
 
188
  def dyn_chart():
189
  # 需要曲線と供給曲線のパラメータ
 
462
  gr.Markdown("# 📄 資料")
463
 
464
  with gr.Row():
465
+ if os.path.exists("./dynamic-pricing.pdf"):
466
+ print("File Exists.")
467
+ pdf_output = PDF(label="資料",value="./dynamic-pricing.pdf")
468
+ else:
469
+ download_pdf()
470
+ pdf_output = PDF(label="資料",value="./dynamic-pricing.pdf")
471
+ #pdf_output = PDF(label="資料",value="./dynamic-pricing.pdf")
472
 
473
  llm.launch(share=True,pwa=True,favicon_path="favicon.ico")