Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,7 @@ from typing import Optional, List
|
|
| 16 |
from enum import Enum
|
| 17 |
from contextlib import asynccontextmanager
|
| 18 |
import torch
|
| 19 |
-
from fastapi import FastAPI, HTTPException, UploadFile, File
|
| 20 |
from fastapi.responses import StreamingResponse, Response
|
| 21 |
from pydantic import BaseModel, Field, field_validator
|
| 22 |
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
|
@@ -1089,8 +1089,8 @@ async def process_long_text(text: str, style: ParaphraseStyle) -> ParaphraseResp
|
|
| 1089 |
@app.post("/humanize-document")
|
| 1090 |
async def humanize_document(
|
| 1091 |
file: UploadFile = File(...),
|
| 1092 |
-
style: ParaphraseStyle = ParaphraseStyle.neutral,
|
| 1093 |
-
output_format: str = "json" # json | docx | pdf
|
| 1094 |
):
|
| 1095 |
"""
|
| 1096 |
Process uploaded document with style-specific paraphrasing.
|
|
@@ -1410,7 +1410,7 @@ async def humanize_document(
|
|
| 1410 |
@app.post("/humanize-document-stream")
|
| 1411 |
async def humanize_document_stream(
|
| 1412 |
file: UploadFile = File(...),
|
| 1413 |
-
style: ParaphraseStyle = ParaphraseStyle.neutral
|
| 1414 |
):
|
| 1415 |
"""
|
| 1416 |
Process document with streaming progress updates.
|
|
|
|
| 16 |
from enum import Enum
|
| 17 |
from contextlib import asynccontextmanager
|
| 18 |
import torch
|
| 19 |
+
from fastapi import FastAPI, HTTPException, UploadFile, File, Form
|
| 20 |
from fastapi.responses import StreamingResponse, Response
|
| 21 |
from pydantic import BaseModel, Field, field_validator
|
| 22 |
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
|
|
|
| 1089 |
@app.post("/humanize-document")
|
| 1090 |
async def humanize_document(
|
| 1091 |
file: UploadFile = File(...),
|
| 1092 |
+
style: ParaphraseStyle = Form(ParaphraseStyle.neutral),
|
| 1093 |
+
output_format: str = Form("json") # json | docx | pdf
|
| 1094 |
):
|
| 1095 |
"""
|
| 1096 |
Process uploaded document with style-specific paraphrasing.
|
|
|
|
| 1410 |
@app.post("/humanize-document-stream")
|
| 1411 |
async def humanize_document_stream(
|
| 1412 |
file: UploadFile = File(...),
|
| 1413 |
+
style: ParaphraseStyle = Form(ParaphraseStyle.neutral)
|
| 1414 |
):
|
| 1415 |
"""
|
| 1416 |
Process document with streaming progress updates.
|