elia-waefler commited on
Commit
045155e
·
1 Parent(s): cd413c7

geplante Erweiterungen

Browse files
Files changed (2) hide show
  1. ai_generated_metadata.txt +3 -7
  2. app.py +22 -14
ai_generated_metadata.txt CHANGED
@@ -1,10 +1,6 @@
1
 
2
- ISB-020-U3-W-E-01-B15100-001-000.pdf;L-Lüftung;'Anlagedokumentation';'Anlagedokumentation';
3
 
4
- ISB-020-U3-W-E-01-B15100-002-000.pdf;L-Lüftung;'Prozessdokumentation';'Prozessdokumentation';
5
 
6
- ISB-020-U3-W-E-01-B15100-003-000.pdf;L-Lüftung;'Anlagedokumentation';'Anlagedokumentation';
7
-
8
- ISB-020-U3-W-E-01-B15100-004-000.pdf;L-Lüftung;'Anlagedokumentation';'Anlagedokumentation';
9
-
10
- ISB-020-U3-W-E-01-B15100-005-000.pdf;L-Lüftung;'Prozessdokumentation';'Prozessdokumentation';
 
1
 
2
+ ISB-020-U3-W-E-01-B15100-006-000.pdf;L-Lüftung;'Anlagedokumentation';'Anlagedokumentation';
3
 
4
+ ISB-020-U3-W-H-01-O15004-002-000.pdf;H-Heizung;'Anlagedokumentation';'Anlagedokumentation';
5
 
6
+ ISB-020-U3-W-E-01-B07005-001-040.pdf;E-Elektroanlagen;<no classification>;<no classification>;
 
 
 
 
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import streamlit as st
2
  import os
3
- import openai
4
  from PyPDF2 import PdfReader
5
  from openai import OpenAI
6
  from langchain.chat_models import ChatOpenAI
@@ -26,6 +26,7 @@ def gpt4_new(prompt_text):
26
 
27
  # Define a function to ask a question to GPT-4
28
  def ask_gpt4(question):
 
29
  try:
30
  # Use the chat function to send a message and get a response
31
  response = ChatOpenAI()
@@ -83,11 +84,18 @@ def json_open(filename):
83
 
84
  def main():
85
  st.title("Doc Classifier")
86
- st.subheader("Limitationen: ")
87
- st.write("bisher nur PDFs")
88
- st.write("nur Disziplin, Doc typ. und Geschoss")
89
- st.write("macht noch viele Fehler, vor allem bei Koordination, Datennetz usw, (unklare Disziplinen)")
90
- st.write("")
 
 
 
 
 
 
 
91
 
92
  if st.text_input("ASK_ASH_PASSWORD: ", type="password") == ASK_ASH_PASSWORD:
93
  uploaded_files = st.file_uploader("PDF Dokument", accept_multiple_files=True)
@@ -104,10 +112,10 @@ def main():
104
  st.write("Disziplin")
105
  st.write(f"")
106
  with col2:
107
- st.write("Disziplin")
108
  st.write(f"")
109
  with col3:
110
- st.write("Disziplin")
111
  st.write(f"")
112
 
113
  for file in uploaded_files:
@@ -115,7 +123,7 @@ def main():
115
  with col1:
116
  with st.spinner("GPT4 at work"):
117
  pdf_text = str(get_pdf_text(file))
118
- prompt_1 = auftrag_0 + auftrag_1_disz + str(Baubranchen_Disziplinen) + pdf_text
119
  answer_1 = gpt4_new(prompt_1)
120
  print(prompt_1)
121
  metadata.append(answer_1)
@@ -123,7 +131,7 @@ def main():
123
 
124
  with col2:
125
  with st.spinner("GPT4 at work"):
126
- prompt_2 = auftrag_0 + auftrag_1_dokt + str(Dokumententypen) + pdf_text
127
  answer_2 = gpt4_new(prompt_2)
128
  print(prompt_2)
129
  metadata.append(answer_2)
@@ -132,7 +140,7 @@ def main():
132
 
133
  with col3:
134
  with st.spinner("GPT4 at work"):
135
- prompt_3 = auftrag_0 + auftrag_1_gesch + str(ASH_Geschosse) + pdf_text
136
  answer_3 = gpt4_new(prompt_3)
137
  print(prompt_3)
138
  metadata.append(answer_2)
@@ -161,9 +169,9 @@ if __name__ == "__main__":
161
  #prompts = ["classify the document, tell me the ", "hello"]
162
  #process_prompts_and_save(prompts)
163
  auftrag_0 = "Klassifiziere dieses Dokument nach "
164
- auftrag_1_disz = "diesen 'Baubranchen Disziplinen': "
165
- auftrag_1_dokt = "diesen 'Dokumententypen': "
166
- auftrag_1_gesch = "diesen 'Geschossen': "
167
  Baubranchen_Disziplinen = ['A-Architektur', 'B-Bauphysik', 'C-Rohrpostanlagen', 'D-Datennetz', 'E-Elektroanlagen',
168
  'F-Fassadenplanung', 'G-Küche', 'H-Heizung', 'I-Innenausbau', 'K-Kälte', 'L-Lüftung',
169
  'M-Medizintechnik', 'N-Fördertechnik', 'O-Gebäudebetrieb', 'P-Sprinkler',
 
1
  import streamlit as st
2
  import os
3
+ # import openai
4
  from PyPDF2 import PdfReader
5
  from openai import OpenAI
6
  from langchain.chat_models import ChatOpenAI
 
26
 
27
  # Define a function to ask a question to GPT-4
28
  def ask_gpt4(question):
29
+ print(question) # we don't have to submit the question?
30
  try:
31
  # Use the chat function to send a message and get a response
32
  response = ChatOpenAI()
 
84
 
85
  def main():
86
  st.title("Doc Classifier")
87
+ l, r = st.columns(2)
88
+ with l:
89
+ st.subheader("Limitationen: ")
90
+ st.write("bisher nur PDFs")
91
+ st.write("nur Disziplin, Doc typ. und Geschoss")
92
+ st.write("macht noch viele Fehler, vor allem bei Koordination, Datennetz usw, (unklare Disziplinen)")
93
+ st.write("")
94
+ with r:
95
+ st.subheader("geplante Erweiterungen:")
96
+ st.write("text beschreibung")
97
+ st.write("jpg, bilder, tabellen, .xlsx, .docx")
98
+ st.write("Ecodomus API einbinden")
99
 
100
  if st.text_input("ASK_ASH_PASSWORD: ", type="password") == ASK_ASH_PASSWORD:
101
  uploaded_files = st.file_uploader("PDF Dokument", accept_multiple_files=True)
 
112
  st.write("Disziplin")
113
  st.write(f"")
114
  with col2:
115
+ st.write("Dokumententyp")
116
  st.write(f"")
117
  with col3:
118
+ st.write("Geschoss")
119
  st.write(f"")
120
 
121
  for file in uploaded_files:
 
123
  with col1:
124
  with st.spinner("GPT4 at work"):
125
  pdf_text = str(get_pdf_text(file))
126
+ prompt_1 = auftrag_0 + auftrag_1_disziplin + str(Baubranchen_Disziplinen) + pdf_text
127
  answer_1 = gpt4_new(prompt_1)
128
  print(prompt_1)
129
  metadata.append(answer_1)
 
131
 
132
  with col2:
133
  with st.spinner("GPT4 at work"):
134
+ prompt_2 = auftrag_0 + auftrag_1_type + str(Dokumententypen) + pdf_text
135
  answer_2 = gpt4_new(prompt_2)
136
  print(prompt_2)
137
  metadata.append(answer_2)
 
140
 
141
  with col3:
142
  with st.spinner("GPT4 at work"):
143
+ prompt_3 = auftrag_0 + auftrag_1_ge + str(ASH_Geschosse) + pdf_text
144
  answer_3 = gpt4_new(prompt_3)
145
  print(prompt_3)
146
  metadata.append(answer_2)
 
169
  #prompts = ["classify the document, tell me the ", "hello"]
170
  #process_prompts_and_save(prompts)
171
  auftrag_0 = "Klassifiziere dieses Dokument nach "
172
+ auftrag_1_disziplin = "diesen 'Baubranchen Disziplinen': "
173
+ auftrag_1_type = "diesen 'Dokumententypen': "
174
+ auftrag_1_ge = "diesen 'Geschossen': "
175
  Baubranchen_Disziplinen = ['A-Architektur', 'B-Bauphysik', 'C-Rohrpostanlagen', 'D-Datennetz', 'E-Elektroanlagen',
176
  'F-Fassadenplanung', 'G-Küche', 'H-Heizung', 'I-Innenausbau', 'K-Kälte', 'L-Lüftung',
177
  'M-Medizintechnik', 'N-Fördertechnik', 'O-Gebäudebetrieb', 'P-Sprinkler',