Spaces:
Runtime error
Runtime error
Delete src/frontend/archive_gui.py
Browse files- src/frontend/archive_gui.py +0 -38
src/frontend/archive_gui.py
DELETED
|
@@ -1,38 +0,0 @@
|
|
| 1 |
-
|
| 2 |
-
import gradio as gr
|
| 3 |
-
import asyncio
|
| 4 |
-
from archive.archive_analyzer import analyze_sources
|
| 5 |
-
from database.models import SessionLocal, DocumentAnalysis
|
| 6 |
-
from archive.cross_reference import cross_reference_results
|
| 7 |
-
|
| 8 |
-
sources = {
|
| 9 |
-
"NSA": "https://www.nsa.gov/about/foia/",
|
| 10 |
-
"NSO": "https://www.archives.gov",
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
def analyze_and_store_with_reference():
|
| 14 |
-
results = asyncio.run(analyze_sources(sources))
|
| 15 |
-
session = SessionLocal()
|
| 16 |
-
for result in results:
|
| 17 |
-
analysis = DocumentAnalysis(
|
| 18 |
-
source=result.get("source"),
|
| 19 |
-
title=result.get("title"),
|
| 20 |
-
links=str(result.get("links")),
|
| 21 |
-
error=result.get("error")
|
| 22 |
-
)
|
| 23 |
-
session.add(analysis)
|
| 24 |
-
session.commit()
|
| 25 |
-
|
| 26 |
-
references = cross_reference_results(results)
|
| 27 |
-
return f"Analysis completed. Common links: {len(references['common_links'])}"
|
| 28 |
-
|
| 29 |
-
interface = gr.Interface(
|
| 30 |
-
fn=analyze_and_store_with_reference,
|
| 31 |
-
inputs=None,
|
| 32 |
-
outputs="text",
|
| 33 |
-
title="Document Archive Analyzer",
|
| 34 |
-
description="Analyze and cross-reference document archives from multiple sources."
|
| 35 |
-
)
|
| 36 |
-
|
| 37 |
-
if __name__ == "__main__":
|
| 38 |
-
interface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|