Spaces:
Paused
Paused
Update app.py
Browse files211 unmodified lines21221321421521621721810 unmodified lines2292302312322332342355 unmodified lines24124224324424524624717 unmodified lines26526626726826927027113 unmodified lines285286287288289290291292211 unmodified lines try: with gr.Progress() as progress: progress(0, "Preparing to send to model...") logging.info("sending to model preparation.") # Basic input validation if model_selection not in ["Clipboard only", "HuggingFace Inference", "Groq API", "OpenAI ChatGPT"]:10 unmodified lines # Call implementation with error handling progress(0.5, "Processing with model...") try: logging.info("calling send_to_model_impl.") summary, download_file = send_to_model_impl( prompt=prompt.strip(), model_selection=model_selection,5 unmodified lines openai_api_key=openai_api_key, openai_model_choice=openai_model_choice ) logging.info("summary received:", summary) if summary is None or not isinstance(summary, str): return "Error: No response from model", None17 unmodified linesdef send_to_model_impl(prompt, model_selection, hf_model_choice, hf_custom_model, hf_api_key, groq_model_choice, groq_api_key, openai_api_key, openai_model_choice): """Implementation of model sending with improved error handling.""" logging.info("send to model impl commencing...") if model_selection == "Clipboard only": return "Text copied to clipboard. Use paste for processing.", None13 unmodified lines return "Error: Invalid model selection", None
# Validate response logging.info("model told us:", summary)
if not summary or not isinstance(summary, str): return "Error: Invalid response from model", None app.py+6