seawolf2357 commited on
Commit
32615be
ยท
verified ยท
1 Parent(s): c981ac4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -12,8 +12,13 @@ def call_api(prompt, history, system_prompt, temperature, max_new_tokens, top_p,
12
  "top_p": top_p,
13
  "repetition_penalty": repetition_penalty
14
  }
15
- response = requests.post(url, json=data)
16
- return response.json()['response']
 
 
 
 
 
17
 
18
  def main_interface():
19
  with gr.Blocks() as demo:
 
12
  "top_p": top_p,
13
  "repetition_penalty": repetition_penalty
14
  }
15
+ try:
16
+ response = requests.post(url, json=data)
17
+ response.raise_for_status() # ์ด ๋ถ€๋ถ„์—์„œ HTTP ์˜ค๋ฅ˜ ๋ฐœ์ƒ ์‹œ ์˜ˆ์™ธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ต๋‹ˆ๋‹ค.
18
+ return response.json()['response']
19
+ except requests.exceptions.RequestException as e:
20
+ return f"An error occurred: {str(e)}"
21
+
22
 
23
  def main_interface():
24
  with gr.Blocks() as demo: