Update app.py
Browse files
app.py
CHANGED
|
@@ -3,24 +3,17 @@ import streamlit as st
|
|
| 3 |
from transformers import pipeline
|
| 4 |
from datasets import load_dataset
|
| 5 |
from huggingface_hub import hf_hub_download
|
| 6 |
-
import
|
| 7 |
-
import os
|
| 8 |
-
|
| 9 |
-
# Clone the dataset repository if not already cloned
|
| 10 |
-
repo_url = "https://huggingface.co/datasets/BEE-spoke-data/survivorslib-law-books"
|
| 11 |
-
repo_dir = "./survivorslib-law-books"
|
| 12 |
|
| 13 |
-
if not os.path.exists(repo_dir):
|
| 14 |
-
subprocess.run(["git", "clone", repo_url], check=True)
|
| 15 |
|
| 16 |
-
# Load the dataset from the cloned repository
|
| 17 |
-
dataset_path = os.path.join(repo_dir, "train.parquet")
|
| 18 |
-
ds = load_dataset("parquet", data_files=dataset_path)
|
| 19 |
|
| 20 |
# Initialize text-generation pipeline with the model
|
| 21 |
model_name = "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF"
|
| 22 |
pipe = pipeline("text-generation", model=model_name)
|
| 23 |
|
|
|
|
|
|
|
|
|
|
| 24 |
# Gradio Interface setup
|
| 25 |
def respond(
|
| 26 |
message,
|
|
@@ -93,4 +86,4 @@ if __name__ == "__main__":
|
|
| 93 |
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
| 94 |
],
|
| 95 |
)
|
| 96 |
-
demo.launch()
|
|
|
|
| 3 |
from transformers import pipeline
|
| 4 |
from datasets import load_dataset
|
| 5 |
from huggingface_hub import hf_hub_download
|
| 6 |
+
from datasets import load_dataset
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
|
|
|
|
|
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Initialize text-generation pipeline with the model
|
| 11 |
model_name = "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF"
|
| 12 |
pipe = pipeline("text-generation", model=model_name)
|
| 13 |
|
| 14 |
+
# Load the dataset from the cloned local direc/tory
|
| 15 |
+
ds = load_dataset("./canadian-legal-data", split="train",verify=False)
|
| 16 |
+
|
| 17 |
# Gradio Interface setup
|
| 18 |
def respond(
|
| 19 |
message,
|
|
|
|
| 86 |
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
| 87 |
],
|
| 88 |
)
|
| 89 |
+
demo.launch()
|