Spaces:
Runtime error
Runtime error
import gradio as gr | |
from qdrant import qdrant_manager | |
from openai_manager import openai_manager | |
description = """ | |
In this project, Im using Few-Shot Learning as an alternative to Fine-Tuning and Prompt | |
Engineering methods. While Prompt Engineering offers a cost-effective and swift approach | |
for development, it falls short in providing a comprehensive level of instruction | |
definition. For instance, crafting instructions that simulate a specific writing style proves to be exceptionally challenging. | |
On the other hand, Fine-Tuning excels in terms of instruction integration as it | |
comprehends and learns instructions rather than merely receiving them. However, it | |
comes with challenges such as complexity, high costs, and time-intensive processes. | |
Few-Shot Learning elegantly positions itself between these two approaches, offering the | |
best of both worlds. It provides an enticing balance that you might want to explore. | |
Why not give it a try? | |
""" | |
def generate(keywords): | |
try: | |
keywords_list = list(map(lambda x: x.strip(), keywords.split(","))) | |
except: | |
keywords_list = [] | |
gr.Warning("Please use ',' to separate Keywords") | |
print("kewords", " ".join(keywords_list)) | |
embedding = openai_manager.get_embeddings("hello my name is zinou") | |
points = qdrant_manager.search_point(query_vector=embedding[0]) | |
return openai_manager.shots(points, " ".join(keywords_list)) | |
iface = gr.Interface( | |
fn=generate, | |
inputs="text", | |
outputs="text", | |
title="Sales Role Play Generator - Few Shots Learning", | |
description=description, | |
) | |
iface.launch() | |