change-tw commited on
Commit
7197948
·
1 Parent(s): 909a959

1. Fine-tune the way to up server

Browse files
Files changed (2) hide show
  1. app.py +5 -5
  2. requirements.txt +1 -1
app.py CHANGED
@@ -9,7 +9,6 @@ from pathlib import Path
9
 
10
  import boto3
11
  import gradio as gr
12
- import httpx
13
  import requests
14
  from langchain.agents import Tool, initialize_agent, AgentType
15
  from langchain.chains import LLMChain, LLMMathChain, StuffDocumentsChain, ConversationalRetrievalChain
@@ -596,16 +595,17 @@ def lunch_style(demo):
596
  demo.launch(allowed_paths=[root_file_path, root_file_path+hr_source_path])
597
  elif len(sys.argv)==2 and sys.argv[1] == "server":
598
  local_ip = "10.51.50.39"
599
- local_port = 3100
600
  print(f"running server on http://{local_ip}:{local_port}")
601
  demo.launch(allowed_paths=[root_file_path, root_file_path+hr_source_path],auth=("Foxconn", "Foxconn123!"),server_name=local_ip, server_port=local_port)
602
  elif len(sys.argv)==4:
603
  local_ip = sys.argv[2]
604
  local_port = sys.argv[3]
605
  print(f"running server on http://{local_ip}:{local_port}")
606
- demo.launch(allowed_paths=[root_file_path, root_file_path+hr_source_path],auth=("Foxconn", "Foxconn123!"),server_name=local_ip, server_port=local_port)
 
607
  else:
608
- print("syntax: pythong <your_app>.py [server {ip_address, port}] ")
609
 
610
 
611
  def poc_init():
@@ -782,7 +782,7 @@ def gradio_run():
782
  upload_button = gr.UploadButton("Click to Upload a File", file_types=["pdf"], file_count="multiple")
783
  upload_button.upload(upload_file, upload_button, file_output)
784
  with gr.Column(scale=2):
785
- gr.ChatInterface(fn=messageHandle, submit_btn=None, examples=[{"text": "請摘要這份文件的內容"}, {"text": "請列出這份會議紀錄的逐字稿"}])
786
  pass
787
  demo.queue(concurrency_count=10)
788
  lunch_style(demo)
 
9
 
10
  import boto3
11
  import gradio as gr
 
12
  import requests
13
  from langchain.agents import Tool, initialize_agent, AgentType
14
  from langchain.chains import LLMChain, LLMMathChain, StuffDocumentsChain, ConversationalRetrievalChain
 
595
  demo.launch(allowed_paths=[root_file_path, root_file_path+hr_source_path])
596
  elif len(sys.argv)==2 and sys.argv[1] == "server":
597
  local_ip = "10.51.50.39"
598
+ local_port = int(3100)
599
  print(f"running server on http://{local_ip}:{local_port}")
600
  demo.launch(allowed_paths=[root_file_path, root_file_path+hr_source_path],auth=("Foxconn", "Foxconn123!"),server_name=local_ip, server_port=local_port)
601
  elif len(sys.argv)==4:
602
  local_ip = sys.argv[2]
603
  local_port = sys.argv[3]
604
  print(f"running server on http://{local_ip}:{local_port}")
605
+ _local_port = int(local_port)
606
+ demo.launch(allowed_paths=[root_file_path, root_file_path+hr_source_path],auth=("Foxconn", "Foxconn123!"),server_name=local_ip, server_port=_local_port)
607
  else:
608
+ print("syntax: python <your_app>.py [server {ip_address, port}] ")
609
 
610
 
611
  def poc_init():
 
782
  upload_button = gr.UploadButton("Click to Upload a File", file_types=["pdf"], file_count="multiple")
783
  upload_button.upload(upload_file, upload_button, file_output)
784
  with gr.Column(scale=2):
785
+ gr.ChatInterface(fn=messageHandle, submit_btn=None, examples=["請摘要這份文件的內容", "請列出這份會議紀錄的逐字稿"])
786
  pass
787
  demo.queue(concurrency_count=10)
788
  lunch_style(demo)
requirements.txt CHANGED
@@ -61,7 +61,7 @@ fsspec==2024.3.1
61
  google-auth==2.29.0
62
  google_search_results==2.4.2
63
  googleapis-common-protos==1.63.0
64
- gradio
65
  gradio_client
66
  greenlet==3.0.3
67
  grpcio==1.62.1
 
61
  google-auth==2.29.0
62
  google_search_results==2.4.2
63
  googleapis-common-protos==1.63.0
64
+ gradio==3.48.0
65
  gradio_client
66
  greenlet==3.0.3
67
  grpcio==1.62.1