import gradio as gr
from llama_cpp import Llama
llm = Llama(model_path="ggml-model-q4_0.bin", n_threads=8, n_ctx=2048, n_batch=128)
def generate_text(input_text):
output = llm(f"{input_text}", max_tokens=200, stop=[], echo=False)
return output['choices'][0]['text']
def main():
app = gr.Blocks()
try:
with app:
title = "Dcard Emotion Post 0.1 Demo"
desc = """ small dcard post generate.
Enter the beginning of story and click the button
It's just a simplified demo, you can use more advanced features optimize quality
"""
tutorial_link = "https://docs.cworld.ai/docs/cworld-ai/quick-start-dcard"
gr.HTML(
f"""