Spaces:
Sleeping
Sleeping
Download app.py from ShabazKnowde/LinkedInCrawl: direct link, hf CLI and curl.
- Browser
- Download file 1.05 kB
-
https://huggingface.co/spaces/ShabazKnowde/LinkedInCrawl/resolve/main/app.py
- Command line
-
hf download hf://spaces/ShabazKnowde/LinkedInCrawl/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ShabazKnowde/LinkedInCrawl/resolve/main/app.py
1.05 kB
| from pydantic import BaseModel | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from fastapi import FastAPI, HTTPException | |
| from linkedin_api import Linkedin | |
| app = FastAPI() | |
| # Enable CORS | |
| # app.add_middleware( | |
| # CORSMiddleware, | |
| # allow_origins=["*"], | |
| # allow_credentials=True, | |
| # allow_methods=["*"], | |
| # allow_headers=["*"], | |
| # ) | |
| # Authenticate using any Linkedin account credentials | |
| class GenerateInput(BaseModel): | |
| prompt: str | |
| def fetch_profile(prompt: str): | |
| if not prompt.strip(): | |
| raise HTTPException(status_code=400, detail="Please provide a non-empty prompt.") | |
| api = Linkedin('suma.shree59@gmail.com', '#845524509suma') | |
| c = api.get_profile(prompt) | |
| return c | |
| async def head_root(): | |
| return {"message": "This is a HEAD request to the root URL."} | |
| def api_home(): | |
| return {'detail': 'Welcome to FastAPI LinkedIn Crawler by Knowde!'} | |
| def inference(data: GenerateInput): | |
| return fetch_profile(data.prompt) |