Timjo88 commited on
Commit
235de1f
Β·
1 Parent(s): 8156e34

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -4,11 +4,12 @@ import pandas as pd
4
  from haystack.schema import Answer
5
  from haystack.document_stores import InMemoryDocumentStore
6
  from haystack.pipelines import FAQPipeline, ExtractiveQAPipeline
7
- from haystack.nodes import EmbeddingRetriever, TfidfRetriever, FARMReader
8
  from haystack.utils import print_answers
 
9
  import logging
10
 
11
- #Haystack function calls
12
 
13
  def start_haystack():
14
  document_store = InMemoryDocumentStore(index="document", embedding_field='embedding', embedding_dim=384, similarity='cosine')
@@ -34,7 +35,16 @@ def predict_faq(question):
34
  answer = prediction["answers"][0].meta
35
  faq_response = "FAQ Question: " + answer["query"] + "\n"+"Answer: " + answer["answer"]
36
  return faq_response
 
 
 
 
 
 
 
37
 
 
 
38
  input_question =gr.inputs.Textbox(label="enter your monopoly question here")
39
  response = "text"
40
  examples = ["how much cash do we get to start with?", "at what point can I buy houses?", "what happens when I land on free parking?"]
@@ -46,7 +56,5 @@ mon_faq = gr.Interface(
46
  examples=examples,
47
  title="Monopoly FAQ Semantic Search")
48
 
49
- feedback_answer =
50
-
51
- def return_feedback(input_question,feedback_answer):
52
 
 
4
  from haystack.schema import Answer
5
  from haystack.document_stores import InMemoryDocumentStore
6
  from haystack.pipelines import FAQPipeline, ExtractiveQAPipeline
7
+ from haystack.nodes import EmbeddingRetriever, TfidfRetriever, FARMReader, PDFToTextConverter
8
  from haystack.utils import print_answers
9
+ from haystack.utils import convert_files_to_docs
10
  import logging
11
 
12
+ # FAQ Haystack function calls
13
 
14
  def start_haystack():
15
  document_store = InMemoryDocumentStore(index="document", embedding_field='embedding', embedding_dim=384, similarity='cosine')
 
35
  answer = prediction["answers"][0].meta
36
  faq_response = "FAQ Question: " + answer["query"] + "\n"+"Answer: " + answer["answer"]
37
  return faq_response
38
+
39
+ # Extractive QA functions
40
+
41
+ def_start_ex_haystack():
42
+ return true
43
+
44
+
45
 
46
+
47
+ # Gradio App section
48
  input_question =gr.inputs.Textbox(label="enter your monopoly question here")
49
  response = "text"
50
  examples = ["how much cash do we get to start with?", "at what point can I buy houses?", "what happens when I land on free parking?"]
 
56
  examples=examples,
57
  title="Monopoly FAQ Semantic Search")
58
 
59
+ # def return_feedback(input_question,feedback_answer):
 
 
60