File size: 1,602 Bytes
c7fa0aa
5ddfe7e
 
c7fa0aa
9bb4c09
 
 
 
 
 
 
 
 
 
 
 
 
c7fa0aa
5ddfe7e
 
 
 
 
 
c7fa0aa
5ddfe7e
 
c7fa0aa
5ddfe7e
 
 
 
 
d9e6b75
 
 
 
 
9bb4c09
d9e6b75
c7fa0aa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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()