k-mktr commited on
Commit
f715d34
·
verified ·
1 Parent(s): dcca2d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -65,11 +65,14 @@ def call_ollama_api(model, prompt):
65
  "content": prompt
66
  }
67
  ],
68
- timeout=100
69
  )
70
  return response.choices[0].message.content
 
 
 
71
  except Exception as e:
72
- logger.error(f"Error calling Ollama API for model {model}: {e}")
73
  return f"Error: Unable to get response from the model."
74
 
75
  # Generate responses using two randomly selected models
 
65
  "content": prompt
66
  }
67
  ],
68
+ timeout=180
69
  )
70
  return response.choices[0].message.content
71
+ except requests.exceptions.Timeout:
72
+ logger.error(f"Timeout error for model {model} after 180 seconds")
73
+ return f"Error: Model response timed out after 180 seconds"
74
  except Exception as e:
75
+ logger.error(f"Error calling Ollama API for model {model}: {str(e)}")
76
  return f"Error: Unable to get response from the model."
77
 
78
  # Generate responses using two randomly selected models