Spaces:
Sleeping
Sleeping
Merge branch 'main' of https://huggingface.co/spaces/piyushgrover/PhiGPT into main
Browse files
app.py
CHANGED
@@ -31,8 +31,8 @@ gen = pipeline('text-generation', model=model, tokenizer=tokenizer, max_length=3
|
|
31 |
|
32 |
|
33 |
def fn_query_on_load():
|
34 |
-
|
35 |
-
return
|
36 |
|
37 |
|
38 |
def generate_response(input):
|
@@ -40,8 +40,10 @@ def generate_response(input):
|
|
40 |
prompt = f"### Human: {input}\n\n### Assistant: "
|
41 |
result = gen(prompt)
|
42 |
|
43 |
-
resp = result[0]['generated_text']
|
44 |
-
|
|
|
|
|
45 |
|
46 |
final_resp = resp_arr[0]
|
47 |
|
|
|
31 |
|
32 |
|
33 |
def fn_query_on_load():
|
34 |
+
input = "Explain nuclear physics to a five year old kid."
|
35 |
+
return input
|
36 |
|
37 |
|
38 |
def generate_response(input):
|
|
|
40 |
prompt = f"### Human: {input}\n\n### Assistant: "
|
41 |
result = gen(prompt)
|
42 |
|
43 |
+
resp = result[0]['generated_text']
|
44 |
+
print(resp)
|
45 |
+
resp_arr = resp.replace(prompt, '').split('###')
|
46 |
+
print(resp_arr)
|
47 |
|
48 |
final_resp = resp_arr[0]
|
49 |
|