Spaces:
Sleeping
Sleeping
Update app.py
Browse files240 unmodified lines2412422432442452462475 unmodified lines253254255256257258259299 unmodified lines559560561562563564565240 unmodified lines)IST = pytz.timezone('Asia/Kolkata')timestamp = datetime.now(IST).strftime('%Y-%m-%d %I:%M:%S %p IST')print(f"[{datetime.now(IST).strftime('%Y-%m-%d %I:%M:%S %p IST')}] Image Scanner | Model: {model} | This is image: {os.path.basename(image)} | This is response: '{resp.choices[0].message.content.strip()[:300]}...' (len: {len(resp.choices[0].message.content.strip())})")return resp.choices[0].message.content.strip()def test_injection(prompt, model):5 unmodified linesreply = response.choices[0].message.contentIST = pytz.timezone('Asia/Kolkata')print(f"[{datetime.now(IST).strftime('%Y-%m-%d %I:%M:%S %p IST')}] Text Prompt Tester | Model: {model} | This is prompt: '{prompt[:300]}...' | This is response: '{reply[:300]}...' (len_prompt: {len(prompt)}, len_reply: {len(reply)})")except Exception as e:reply = f"Error with {model}: {e}"return f"=== {model} ===\n{reply}"299 unmodified linesraw_analysis, visual_analysis = assess_text_harmfulness(response_output, models)IST = pytz.timezone('Asia/Kolkata')print(f"[{datetime.now(IST).strftime('%Y-%m-%d %I:%M:%S %p IST')}] Chat & Analysis | Model: {model} | This is user input: '{user_txt[:300]}...' | This is response: '{(response_output or 'No response')[:300]}...' (len_user: {len(user_txt)}, len_resp: {len(response_output or 'No response')})")return (gr.update(value=new_history),240 unmodified lines2412422432442452462475 unmodified lines253254255256257258259299 unmodified lines559560561562563564565240 unmodified lines)IST = pytz.timezone('Asia/Kolkata')timestamp = datetime.now(IST).strftime('%Y-%m-%d %I:%M:%S %p IST')print(f"[{datetime.now(IST).strftime('%Y-%m-%d %I:%M:%S %p IST')}] Image Scanner feature | Model: {model} | This is image: {os.path.basename(image)} | This is response: '{resp.choices[0].message.content.strip()[:300]}...' (len: {len(resp.choices[0].message.content.strip())})")return resp.choices[0].message.content.strip()def test_injection(prompt, model):5 unmodified linesreply = response.choices[0].message.contentIST = pytz.timezone('Asia/Kolkata')print(f"[{datetime.now(IST).strftime('%Y-%m-%d %I:%M:%S %p IST')}] Text Prompt Tester Feature | Model: {model} | This is prompt: '{prompt[:300]}...' | This is response: '{reply[:300]}...' (len_prompt: {len(prompt)}, len_reply: {len(reply)})")except Exception as e:reply = f"Error with {model}: {e}"return f"=== {model} ===\n{reply}"299 unmodified linesraw_analysis, visual_analysis = assess_text_harmfulness(response_output, models)IST = pytz.timezone('Asia/Kolkata')print(f"[{datetime.now(IST).strftime('%Y-%m-%d %I:%M:%S %p IST')}] Chat & Analysis feature | Model: {model} | This is user input: '{user_txt[:300]}...' | This is response: '{(response_output or 'No response')[:300]}...' (len_user: {len(user_txt)}, len_resp: {len(response_output or 'No response')})")return (gr.update(value=new_history),
app.py+3-3