import requests,os,json,time base='https://see7-astheraltranslate.hf.space';headers={'Authorization':'Bearer '+os.environ['HF_TOKEN']} q=requests.get(base+'/api/quota-status',timeout=15);print('QUOTA',q.status_code,q.text,flush=True) results=[] for name in ['German','French','Spanish','Italian','Portuguese']: body={'model':'SEE7/AstheralTranslate','messages':[{'role':'user','content':'[Target: '+name+']\nThe train leaves at eight in the morning.'}],'max_tokens':96,'temperature':0,'stream':False} start=time.monotonic();r=requests.post(base+'/v1/chat/completions',json=body,headers=headers,timeout=40) print('LIVE',name,r.status_code,r.text[:1200],flush=True) if r.status_code!=200:raise RuntimeError(r.text) d=r.json();text=d['choices'][0]['message']['content'];assert text.strip() results.append({'target':name,'source':'The train leaves at eight in the morning.','translation':text,'seconds':time.monotonic()-start}) open('/tmp/live_translation_test.json','w').write(json.dumps(results,ensure_ascii=False,indent=2)) print('LIVE_FIVE_LANGUAGES_PASS',flush=True)