Spaces:
Runtime error
Runtime error
feat: record everything in data.json
Browse files2 unmodified lines345678942 unmodified lines525354545556575859555657123 unmodified lines1811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142 unmodified linesimport shutilimport requestsimport threadingimport time
import gradio as grfrom huggingface_hub import Repository, InferenceClient42 unmodified linesf_stop = threading.Event()asynchronous_push(f_stop)
def vote(data: gr.LikeData): if data.liked: print("You upvoted this response: " + data.value) else: print("You downvoted this response: " + data.value)
def format_prompt(message, history, system_prompt): prompt = "" if system_prompt:123 unmodified lines
return possible_generation
def vote(data: gr.LikeData): if data.liked: print("You upvoted this response: " + data.value) else: print("You downvoted this response: " + data.value)
print(data)
with open(DATA_FILE, "a") as jsonlfile: json_data = [ json.dumps( { "index": data.index, "time_stamp": time.time(), "prompt": "", "history": "", "system prompt": additional_inputs[0].value, "temperature": additional_inputs[1].value, "max_new_tokens": additional_inputs[2].value, "top_p": additional_inputs[3].value, "repetition_penalty": additional_inputs[4].value, "response": data.value, "label": data.liked, } ) ] jsonlfile.write("\n".join(json_data) + "\n")
with gr.Blocks(css=CSS) as demo: with gr.Row(): with gr.Column():app.py+29-6