Spaces:
Sleeping
Sleeping
Update app.py
Browse files7 unmodified lines89101112131414 unmodified lines293031323334353637383940414243444546474849505152535455564 unmodified lines61626364656667687 unmodified linesloop = asyncio.get_event_loop()gradio_client = GrClient('https://ldhldh-demo.hf.space/')# Monkey patchdef get_types(cls_set: List[Type], component: str):docset = []14 unmodified linesroutes.get_types = get_types# App codedef chat(x):x = f"[***λλ Assistantμ λλ€. μλμκ² λ€μν μ§λ¬Έμ νλ©° λνλ₯Ό μ΄λκ³ μμ΅λλ€. Humanμκ² κΈμ μ μ΄κ³ , 곡κ°νλ©°, μ΅λν κΈΈκ² λλ΅ν΄μ£ΌμΈμ***]\nHuman: {x}\n\n###\nAssistant:"print("\n___________________\n" + f"{x}")result = gradio_client.predict(x,# str representing input in 'User input' Textbox component0.91, # float, representing input in 'Top-p (nucleus sampling)' Slider component10, # int, representing input in 'Top-k (nucleus sampling)' Slider component0.65, # float, representing input in 'Temperature' Slider component20, # int, representing input in 'Max New Tokens' Slider component1.2, # float, representing input in 'repetition_penalty' Slider componentfn_index=0)result = str(result)output = result[len(x.rsplit(':', 1)[0])+2:]output = re.sub('νν','γ γ ', output)output = output.split('λ')[0]output = output.split('endoftext')[0]output = re.sub('[=+#/\:@*\"β»γγβ|\\\<\>\(\)\[\]`\'β¦γ\β\β\βΒ·]', '', output)#output = re.sub('[a-zA-Z]',' ',output)return output4 unmodified linesinputs="text",outputs="text",description="chat",#examples= [[f"\nfriend: λλ κΏμ΄ λμΌ? \nyou: "],[f"\nyou: λλ λ¬΄μ¨ μμ κ°μ₯ μ’μν΄? \nfriend: κΈμ λλ? \nyou: "]]examples= [[f"λλ κΏμ΄ λμΌ?"],[f"λλ λ¬΄μ¨ μμ κ°μ₯ μ’μν΄?"]])demo.queue(max_size=32).launch(enable_queue=True)7 unmodified lines89101112131414 unmodified lines2930313233343536373839404142434 unmodified lines484950515253547 unmodified linesloop = asyncio.get_event_loop()gradio_client = GrClient('https://ldhldh-demoforkakaoapi.hf.space/')# Monkey patchdef get_types(cls_set: List[Type], component: str):docset = []14 unmodified linesroutes.get_types = get_types# App codedef chat(x):result = gradio_client.predict(x,# str representing input in 'User input' Textbox component5,fn_index=0)result = str(result)output = result[len(x.rsplit(':', 1)[0]):]return output4 unmodified linesinputs="text",outputs="text",description="chat",examples= [[f"λλ κΏμ΄ λμΌ?"],[f"λλ λ¬΄μ¨ μμ κ°μ₯ μ’μν΄?"]])demo.queue(max_size=32).launch(enable_queue=True)
app.py+5-19