tulika awalgaonkar commited on
Commit
7183719
1 Parent(s): 6d0eb04

lamini playground

Browse files
Files changed (2) hide show
  1. app.py +21 -3
  2. requirements.txt +1 -0
app.py CHANGED
@@ -1,7 +1,25 @@
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  iface.launch()
 
1
  import gradio as gr
2
+ from llama import Type, Context, LLM
3
+ import os
4
 
5
+ class UserQuery(Type):
6
+ text: str = Context("what is the user's intent")
7
 
8
+ def lamini(input):
9
+ #return "Hello " + name + "!!"
10
+ llm=LLM(name="lamini-instruct",
11
+ config={
12
+ "production":{
13
+ "key": os.environ['LAMINI-KEY']
14
+ }
15
+ })
16
+ user_query_text=UserQuery(text=input)
17
+ result = llm(
18
+ input=user_query_text,
19
+ output_type=UserQuery,
20
+ model_name="lamini/instruct"
21
+ )
22
+ return result.text
23
+
24
+ iface = gr.Interface(fn=lamini, inputs="text", outputs="text")
25
  iface.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ llama-llm