Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -2050,13 +2050,45 @@ def process_pdfs(pdf_files):
|
|
| 2050 |
# Create Gradio interface with better styling
|
| 2051 |
with gr.Blocks(
|
| 2052 |
title="Real Estate Financial Model Generator",
|
| 2053 |
-
theme=gr.themes.
|
| 2054 |
css="""
|
| 2055 |
.gradio-container {
|
| 2056 |
max-width: 1200px !important;
|
|
|
|
| 2057 |
}
|
| 2058 |
.output-text {
|
| 2059 |
font-family: monospace;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2060 |
}
|
| 2061 |
"""
|
| 2062 |
) as demo:
|
|
@@ -2070,25 +2102,26 @@ with gr.Blocks(
|
|
| 2070 |
with gr.Row():
|
| 2071 |
with gr.Column(scale=2):
|
| 2072 |
pdf_input = gr.File(
|
| 2073 |
-
label="
|
| 2074 |
file_count="multiple",
|
| 2075 |
file_types=[".pdf", ".xlsx", ".xls"],
|
| 2076 |
-
type="filepath"
|
|
|
|
| 2077 |
)
|
| 2078 |
|
| 2079 |
process_btn = gr.Button(
|
| 2080 |
-
"
|
| 2081 |
variant="primary",
|
| 2082 |
size="lg"
|
| 2083 |
)
|
| 2084 |
|
| 2085 |
with gr.Column(scale=1):
|
| 2086 |
gr.Markdown("""
|
| 2087 |
-
###
|
| 2088 |
- **PDF**: Offering Memorandum, Reports
|
| 2089 |
- **XLSX/XLS**: Financial statements, data tables
|
| 2090 |
|
| 2091 |
-
###
|
| 2092 |
- Offering Memorandum
|
| 2093 |
- Operating Expenses Summary
|
| 2094 |
- Sales Comps
|
|
@@ -2096,16 +2129,16 @@ with gr.Blocks(
|
|
| 2096 |
- Market Report
|
| 2097 |
- Demographics Overview
|
| 2098 |
|
| 2099 |
-
###
|
| 2100 |
-
-
|
| 2101 |
-
-
|
| 2102 |
-
-
|
| 2103 |
-
-
|
| 2104 |
""")
|
| 2105 |
|
| 2106 |
with gr.Row():
|
| 2107 |
output_text = gr.Textbox(
|
| 2108 |
-
label="
|
| 2109 |
lines=15,
|
| 2110 |
interactive=False,
|
| 2111 |
elem_classes=["output-text"]
|
|
@@ -2113,7 +2146,7 @@ with gr.Blocks(
|
|
| 2113 |
|
| 2114 |
with gr.Row():
|
| 2115 |
excel_output = gr.File(
|
| 2116 |
-
label="
|
| 2117 |
interactive=False
|
| 2118 |
)
|
| 2119 |
|
|
@@ -2127,13 +2160,13 @@ with gr.Blocks(
|
|
| 2127 |
|
| 2128 |
gr.Markdown("""
|
| 2129 |
---
|
| 2130 |
-
###
|
| 2131 |
- Ensure PDF files are readable and not scanned images
|
| 2132 |
- Use descriptive filenames (e.g., "Offering_Memorandum.pdf")
|
| 2133 |
- Processing may take 30-60 seconds depending on file sizes
|
| 2134 |
- Check the **Processing Results** section for detailed feedback
|
| 2135 |
|
| 2136 |
-
###
|
| 2137 |
- `POST /api/generate-model` - Generate Excel only
|
| 2138 |
- `POST /api/generate-model-with-summary` - Generate Excel + JSON summary
|
| 2139 |
- `POST /api/analyze-only` - Generate JSON summary only
|
|
|
|
| 2050 |
# Create Gradio interface with better styling
|
| 2051 |
with gr.Blocks(
|
| 2052 |
title="Real Estate Financial Model Generator",
|
| 2053 |
+
theme=gr.themes.Soft(),
|
| 2054 |
css="""
|
| 2055 |
.gradio-container {
|
| 2056 |
max-width: 1200px !important;
|
| 2057 |
+
margin: 0 auto;
|
| 2058 |
}
|
| 2059 |
.output-text {
|
| 2060 |
font-family: monospace;
|
| 2061 |
+
font-size: 14px !important;
|
| 2062 |
+
}
|
| 2063 |
+
.file-upload {
|
| 2064 |
+
border: 2px dashed #ccc !important;
|
| 2065 |
+
border-radius: 10px !important;
|
| 2066 |
+
padding: 20px !important;
|
| 2067 |
+
}
|
| 2068 |
+
.icon {
|
| 2069 |
+
font-size: 16px !important;
|
| 2070 |
+
}
|
| 2071 |
+
.gr-button {
|
| 2072 |
+
font-size: 16px !important;
|
| 2073 |
+
}
|
| 2074 |
+
.gr-markdown h1 {
|
| 2075 |
+
font-size: 2em !important;
|
| 2076 |
+
margin-bottom: 0.5em !important;
|
| 2077 |
+
}
|
| 2078 |
+
.gr-markdown h2 {
|
| 2079 |
+
font-size: 1.5em !important;
|
| 2080 |
+
margin-bottom: 0.5em !important;
|
| 2081 |
+
}
|
| 2082 |
+
.gr-markdown h3 {
|
| 2083 |
+
font-size: 1.2em !important;
|
| 2084 |
+
margin-bottom: 0.5em !important;
|
| 2085 |
+
}
|
| 2086 |
+
.upload-text {
|
| 2087 |
+
font-size: 14px !important;
|
| 2088 |
+
}
|
| 2089 |
+
.container {
|
| 2090 |
+
max-width: 1200px;
|
| 2091 |
+
margin: 0 auto;
|
| 2092 |
}
|
| 2093 |
"""
|
| 2094 |
) as demo:
|
|
|
|
| 2102 |
with gr.Row():
|
| 2103 |
with gr.Column(scale=2):
|
| 2104 |
pdf_input = gr.File(
|
| 2105 |
+
label="Upload PDF/XLSX Files",
|
| 2106 |
file_count="multiple",
|
| 2107 |
file_types=[".pdf", ".xlsx", ".xls"],
|
| 2108 |
+
type="filepath",
|
| 2109 |
+
elem_classes=["file-upload"]
|
| 2110 |
)
|
| 2111 |
|
| 2112 |
process_btn = gr.Button(
|
| 2113 |
+
"Generate Financial Model",
|
| 2114 |
variant="primary",
|
| 2115 |
size="lg"
|
| 2116 |
)
|
| 2117 |
|
| 2118 |
with gr.Column(scale=1):
|
| 2119 |
gr.Markdown("""
|
| 2120 |
+
### Supported Formats
|
| 2121 |
- **PDF**: Offering Memorandum, Reports
|
| 2122 |
- **XLSX/XLS**: Financial statements, data tables
|
| 2123 |
|
| 2124 |
+
### Required Documents
|
| 2125 |
- Offering Memorandum
|
| 2126 |
- Operating Expenses Summary
|
| 2127 |
- Sales Comps
|
|
|
|
| 2129 |
- Market Report
|
| 2130 |
- Demographics Overview
|
| 2131 |
|
| 2132 |
+
### Features
|
| 2133 |
+
- Automated data extraction
|
| 2134 |
+
- Formula calculations
|
| 2135 |
+
- Professional Excel output
|
| 2136 |
+
- Multiple analysis sheets
|
| 2137 |
""")
|
| 2138 |
|
| 2139 |
with gr.Row():
|
| 2140 |
output_text = gr.Textbox(
|
| 2141 |
+
label="Processing Results",
|
| 2142 |
lines=15,
|
| 2143 |
interactive=False,
|
| 2144 |
elem_classes=["output-text"]
|
|
|
|
| 2146 |
|
| 2147 |
with gr.Row():
|
| 2148 |
excel_output = gr.File(
|
| 2149 |
+
label="Download Excel File",
|
| 2150 |
interactive=False
|
| 2151 |
)
|
| 2152 |
|
|
|
|
| 2160 |
|
| 2161 |
gr.Markdown("""
|
| 2162 |
---
|
| 2163 |
+
### Tips
|
| 2164 |
- Ensure PDF files are readable and not scanned images
|
| 2165 |
- Use descriptive filenames (e.g., "Offering_Memorandum.pdf")
|
| 2166 |
- Processing may take 30-60 seconds depending on file sizes
|
| 2167 |
- Check the **Processing Results** section for detailed feedback
|
| 2168 |
|
| 2169 |
+
### API Endpoints
|
| 2170 |
- `POST /api/generate-model` - Generate Excel only
|
| 2171 |
- `POST /api/generate-model-with-summary` - Generate Excel + JSON summary
|
| 2172 |
- `POST /api/analyze-only` - Generate JSON summary only
|