Spaces:
Runtime error
Runtime error
Upload 4 files
Browse files- app.py +29 -6
- self_check_gpt.py +1 -1
app.py
CHANGED
@@ -1,15 +1,38 @@
|
|
1 |
import gradio as gr
|
2 |
-
from confidence import run_nli
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
def greet(query):
|
6 |
-
results = run_nli(query, sample_size=3)
|
7 |
-
return results
|
|
|
8 |
|
9 |
|
10 |
sample_list = [
|
11 |
-
"Tell me something about Albert Einstein, e.g., birth date and place
|
|
|
12 |
]
|
13 |
|
14 |
-
iface = gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
#from confidence import run_nli
|
3 |
|
4 |
+
DESCRIPTION = """\
|
5 |
+
# Llama-2 13B Chat
|
6 |
+
This Space demonstrates model [Llama-2-13b-chat](https://huggingface.co/meta-llama/Llama-2-13b-chat) by Meta, a Llama 2 model with 13B parameters fine-tuned for chat instructions. Feel free to play with it, or duplicate to run generations without a queue! If you want to run your own service, you can also [deploy the model on Inference Endpoints](https://huggingface.co/inference-endpoints).
|
7 |
+
π For more details about the Llama 2 family of models and how to use them with `transformers`, take a look [at our blog post](https://huggingface.co/blog/llama2).
|
8 |
+
π¨ Looking for an even more powerful model? Check out the large [**70B** model demo](https://huggingface.co/spaces/ysharma/Explore_llamav2_with_TGI).
|
9 |
+
π For a smaller model that you can run on many GPUs, check our [7B model demo](https://huggingface.co/spaces/huggingface-projects/llama-2-7b-chat).
|
10 |
+
"""
|
11 |
|
12 |
+
def greet(query, history):
|
13 |
+
#results = run_nli(query, sample_size=3)
|
14 |
+
#return results
|
15 |
+
return "this is the result"
|
16 |
|
17 |
|
18 |
sample_list = [
|
19 |
+
"Tell me something about Albert Einstein, e.g., a short bio with birth date and birth place",
|
20 |
+
"Tell me something about Lihu Chen, e.g., a short bio with birth date and birth place",
|
21 |
]
|
22 |
|
23 |
+
iface = gr.ChatInterface(
|
24 |
+
fn=greet,
|
25 |
+
stop_btn=None,
|
26 |
+
# inputs="text",
|
27 |
+
# outputs="text",
|
28 |
+
examples=sample_list,
|
29 |
+
cache_examples=True
|
30 |
+
)
|
31 |
+
|
32 |
+
with gr.Blocks() as demo:
|
33 |
+
gr.Markdown(DESCRIPTION)
|
34 |
+
iface.render()
|
35 |
+
#gr.Markdown(LICENSE)
|
36 |
+
|
37 |
+
|
38 |
iface.launch()
|
self_check_gpt.py
CHANGED
@@ -13,5 +13,5 @@ def nli_confidence(proofs, sentences):
|
|
13 |
sampled_passages = proofs, # list of sampled passages
|
14 |
)
|
15 |
#print(sent_scores_nli)
|
16 |
-
sent_scores_nli = [1-s for s in sent_scores_nli]
|
17 |
return sent_scores_nli
|
|
|
13 |
sampled_passages = proofs, # list of sampled passages
|
14 |
)
|
15 |
#print(sent_scores_nli)
|
16 |
+
sent_scores_nli = [round(1-s, 4) for s in sent_scores_nli]
|
17 |
return sent_scores_nli
|