Spaces:
Running
Running
Commit
·
f8b00dc
1
Parent(s):
383cecf
Update app.py
Browse files
app.py
CHANGED
@@ -10,20 +10,23 @@ def generate_prompts(user_input):
|
|
10 |
template=f"Just list 10 quetion prompts for {user_input} and don't put number before each of the prompts."
|
11 |
)
|
12 |
config = {'max_new_tokens': 2048, 'temperature': 0.7, 'context_length': 4096}
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
17 |
-
|
18 |
-
llm = CTransformers(model, tokenizer)
|
19 |
-
|
20 |
hub_chain = LLMChain(prompt = prompt_template, llm = llm)
|
|
|
21 |
input_data = {"Question": user_input}
|
22 |
-
|
23 |
-
|
|
|
|
|
24 |
questions_list = generated_prompts.split('\n')
|
|
|
|
|
25 |
formatted_questions = "\n".join(f"Question: {question}" for i, question in enumerate(questions_list) if question.strip())
|
26 |
questions_list = formatted_questions.split("Question:")[1:]
|
|
|
|
|
27 |
return questions_list
|
28 |
|
29 |
def answer_question(prompt):
|
|
|
10 |
template=f"Just list 10 quetion prompts for {user_input} and don't put number before each of the prompts."
|
11 |
)
|
12 |
config = {'max_new_tokens': 2048, 'temperature': 0.7, 'context_length': 4096}
|
13 |
+
llm = CTransformers(model="https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GGUF",
|
14 |
+
config=config,
|
15 |
+
threads=os.cpu_count())
|
|
|
|
|
|
|
|
|
16 |
hub_chain = LLMChain(prompt = prompt_template, llm = llm)
|
17 |
+
|
18 |
input_data = {"Question": user_input}
|
19 |
+
|
20 |
+
# Here you would integrate your prompt template with your model
|
21 |
+
# For demonstration, this is just a placeholder
|
22 |
+
generated_prompts = hub_chain.run(input_data) # Modify this part based on how you run the model
|
23 |
questions_list = generated_prompts.split('\n')
|
24 |
+
|
25 |
+
|
26 |
formatted_questions = "\n".join(f"Question: {question}" for i, question in enumerate(questions_list) if question.strip())
|
27 |
questions_list = formatted_questions.split("Question:")[1:]
|
28 |
+
|
29 |
+
|
30 |
return questions_list
|
31 |
|
32 |
def answer_question(prompt):
|