Spaces:
Runtime error
Runtime error
Commit
·
c8ef8f1
1
Parent(s):
525ad25
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,7 +41,9 @@ class KeyValueExtractor:
|
|
| 41 |
pdf_file_path (str): The path to the input PDF file.
|
| 42 |
"""
|
| 43 |
self.model = "facebook/bart-large-mnli"
|
| 44 |
-
|
|
|
|
|
|
|
| 45 |
|
| 46 |
def get_news(self,keyword):
|
| 47 |
|
|
@@ -216,6 +218,8 @@ class KeyValueExtractor:
|
|
| 216 |
|
| 217 |
try:
|
| 218 |
|
|
|
|
|
|
|
| 219 |
# Use OpenAI's Completion API to analyze the text and extract key-value pairs
|
| 220 |
response = openai.Completion.create(
|
| 221 |
engine="text-davinci-003", # You can choose a different engine as well
|
|
@@ -671,5 +675,7 @@ class KeyValueExtractor:
|
|
| 671 |
|
| 672 |
app.launch(debug = True)
|
| 673 |
|
| 674 |
-
|
| 675 |
-
|
|
|
|
|
|
|
|
|
| 41 |
pdf_file_path (str): The path to the input PDF file.
|
| 42 |
"""
|
| 43 |
self.model = "facebook/bart-large-mnli"
|
| 44 |
+
openai.api_key = "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"
|
| 45 |
+
OPENAI_API_KEY = "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"
|
| 46 |
+
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
|
| 47 |
|
| 48 |
def get_news(self,keyword):
|
| 49 |
|
|
|
|
| 218 |
|
| 219 |
try:
|
| 220 |
|
| 221 |
+
openai.api_key = "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"
|
| 222 |
+
|
| 223 |
# Use OpenAI's Completion API to analyze the text and extract key-value pairs
|
| 224 |
response = openai.Completion.create(
|
| 225 |
engine="text-davinci-003", # You can choose a different engine as well
|
|
|
|
| 675 |
|
| 676 |
app.launch(debug = True)
|
| 677 |
|
| 678 |
+
if __name__ == "__main__":
|
| 679 |
+
|
| 680 |
+
text_process = KeyValueExtractor()
|
| 681 |
+
text_process.gradio_interface()
|