Spaces:
Sleeping
Sleeping
Update main.py
Browse files51 unmodified lines525354555657585960616263646566676869707172737475767751 unmodified linesmax_new_tokens = input_data.max_new_tokenstop_p = input_data.top_prepetition_penalty = input_data.repetition_penaltyhistory = []input_text = f'''{{"input": {{"role": "system","content": "{input_data.systemRole}","style": "{input_data.systemStyle}"}},"messages": [{{"role": "instructions","content": "{input_data.instruction}"}},{{"role": "user","content": "{input_data.input}"}}]}}'''print(f"{datetime.now()} - Input Text: {input_text}")generated_response = generate(input_text, history, temperature, max_new_tokens, top_p, repetition_penalty)print(f"{datetime.now()} - Response Text: {generated_response}")51 unmodified lines52535455565758596061626364656667686970717273747576777879808182838485868751 unmodified linesmax_new_tokens = input_data.max_new_tokenstop_p = input_data.top_prepetition_penalty = input_data.repetition_penaltyif input_data.instruction.startswith("http"):try:resp = requests.get(input_data.instruction)resp.raise_for_status() # Lancia un'eccezione per errori HTTPinput_data.instruction = resp.textexcept requests.exceptions.RequestException as e:input_data.instruction = ""history = []if input_data.systemRole != "" or input_data.systemStyle != "" or input_data.instruction != ""input_text = f'''{{"input": {{"role": "system","content": "{input_data.systemRole}","style": "{input_data.systemStyle}"}},"messages": [{{"role": "instructions","content": "{input_data.instruction}"}},{{"role": "user","content": "{input_data.input}"}}]}}'''else:input_text = input_data.inputprint(f"{datetime.now()} - Input Text: {input_text}")generated_response = generate(input_text, history, temperature, max_new_tokens, top_p, repetition_penalty)print(f"{datetime.now()} - Response Text: {generated_response}")
main.py+28-18