siddhantuniyal commited on
Commit
16bbc96
1 Parent(s): 0bc3a97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -9,8 +9,11 @@ genai.configure(api_key = api_key )
9
 
10
  def get_response(level , number_of_words , how_many_errors , topic):
11
 
12
- response = model.generate_content(f"I have an assignment which should seem like it is made by a {level}, it should have atleast {number_of_words} characters and should contain {how_many_errors} errors. The topic is '{topic}.'")
13
- return response.text
 
 
 
14
 
15
  iface = gr.Interface(
16
  fn = get_response,
 
9
 
10
  def get_response(level , number_of_words , how_many_errors , topic):
11
 
12
+ try:
13
+ response = model.generate_content(f"I have an assignment which should seem like it is made by a {level}, it should have atleast {number_of_words} characters and should contain {how_many_errors} errors. The topic is '{topic}.'")
14
+ return response.text
15
+ except Exception as e:
16
+ return "Invalid Input"
17
 
18
  iface = gr.Interface(
19
  fn = get_response,