Spaces:
Running
Running
tulika awalgaonkar
commited on
Commit
•
3d5df29
1
Parent(s):
9006421
lamini-playground
Browse files
app.py
CHANGED
@@ -2,8 +2,11 @@ import gradio as gr
|
|
2 |
from llama import Type, Context, LLM
|
3 |
import os
|
4 |
|
5 |
-
class
|
6 |
-
question: str = Context("
|
|
|
|
|
|
|
7 |
|
8 |
def lamini(input):
|
9 |
#return "Hello " + name + "!!"
|
@@ -13,13 +16,13 @@ def lamini(input):
|
|
13 |
"key": os.environ["LAMINI-KEY"]
|
14 |
}
|
15 |
})
|
16 |
-
user_query_text=
|
17 |
result = llm(
|
18 |
input=user_query_text,
|
19 |
-
output_type=
|
20 |
model_name="lamini/instruct-tuned-2.8b"
|
21 |
)
|
22 |
-
return result.
|
23 |
|
24 |
iface = gr.Interface(fn=lamini, inputs="text", outputs="text")
|
25 |
iface.launch()
|
|
|
2 |
from llama import Type, Context, LLM
|
3 |
import os
|
4 |
|
5 |
+
class Question(Type):
|
6 |
+
question: str = Context("a question")
|
7 |
+
|
8 |
+
class Response(Type):
|
9 |
+
response: str = Context("the response to the question")
|
10 |
|
11 |
def lamini(input):
|
12 |
#return "Hello " + name + "!!"
|
|
|
16 |
"key": os.environ["LAMINI-KEY"]
|
17 |
}
|
18 |
})
|
19 |
+
user_query_text=Question(question=input)
|
20 |
result = llm(
|
21 |
input=user_query_text,
|
22 |
+
output_type=Response,
|
23 |
model_name="lamini/instruct-tuned-2.8b"
|
24 |
)
|
25 |
+
return result.response
|
26 |
|
27 |
iface = gr.Interface(fn=lamini, inputs="text", outputs="text")
|
28 |
iface.launch()
|