import gradio as gr
from gradio.inputs import Textbox, Slider
# Template
title = "A conversation with some NPC in a Tavern 🍻"
description = ""
article = """
If you liked don't forget to 💖 the project 🥰
Parameters:
- npc_prompt: prompt of the NPC, we can modify it to see if results are better.
- top_p: control how deterministic the model is in generating a response.
- temperature: (sampling temperature) higher values means the model will take more risks.
- max_new_tokens: Max number of tokens in generation.
"""
theme="huggingface"
#examples = [[0.9, 1.1, 50, "Hey Gandalf! How are you?"], [0.9, 1.1, 50, "Hey Gandalf, why you didn't use the great eagles to fly Frodo to Mordor?"]]
def generate_text():
pass
io = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
iface = gr.Interface(fn=generate_text,
inputs=[Textbox(label="Prompt"),
Slider(minimum=0.5, maximum=1, step=0.05, default=0.9, label="top_p"),
Slider(minimum=0.5, maximum=1.5, step=0.1, default=1.1, label="temperature"),
Slider(minimum=20, maximum=250, step=10, default=50, label="max_new_tokens")],
outputs="text",
examples="",
allow_screenshot=True,
allow_flagging=True,
title=title,
article=article,
theme=theme)
if __name__ == "__main__":
iface.launch()