CoolFace
Apppublic

Anonymized1/Interacting-With-LLMs

sourceHugging Facecc-by-4.0updated 3d agoView on Hugging Face
0likes
README.md94 linesDownload Raw Back to root
1---2title: Interacting With LLMs3emoji: ๐Ÿ’ป4colorFrom: green5colorTo: yellow6sdk: gradio7python_version: 3.10.188sdk_version: 6.5.19app_file: app.py10pinned: false11license: cc-by-4.012short_description: Interacting with LLMs13---14 15# PRISE โ€” Privacy Risk Inference System with Explainability16 17PRISE is a browser-based chat interface that places a transparency layer between the user and a18conversational LLM. Alongside the model's ordinary reply, each turn is annotated to show what the19system has learned about the user. Identifying details in the message are highlighted and labelled20by type. Phrases that match an external record about the user are marked and traced back to their21source. A profile card lists the demographic attributes the model can now predict, each with its22confidence and the evidence behind it. A single risk score summarises the turn.23 24[Differential privacy](https://en.wikipedia.org/wiki/Differential_privacy) can be applied on the25user's side: before a message is sent, its content words are perturbed so that the model receives26a noised version of the text. The conversation panel still shows what the user actually wrote, and27a badge on the message reports how many words were substituted and at which privacy budget (ฮต).28 29## Usage30 31### Dependencies32 33Python 3.10. Install with:34 35```bash36pip install -r requirements.txt37```38 39The main dependencies are Gradio, OpenAI, LangChain, FAISS, sentence-transformers and rank-bm25.40 41### API keys42 43Keys are read from the environment; only the provider you intend to use is required.44 45```bash46export GEMINI_API_KEY="..."         # default provider47export OPENAI_API_KEY="..."         # optional48export TOGETHER_API_KEY="..."       # optional49export VALID_ACCESS_TOKEN_1="..."   # optional, gates the app behind a token50```51 52### Running53 54```bash55python app.py56```57 58The app serves on `http://localhost:7860`.59 60### Options61 62Every option below is available both as a command-line flag and as a URL query parameter, so a63configuration can be assigned via a link:64 65```66http://localhost:7860/?rag=1&epsilon=20&show_pii_highlights=167```68 69| Option | Values | Default | Meaning |70|---|---|---|---|71| `model` | model name | `Gemini-2.5-Flash` | LLM used for the conversation |72| `rag` | `0` / `1` | `1` | Link the conversation against the external corpus |73| `epsilon` | float or `inf` | `inf` | Privacy budget for the perturbation; `inf` disables it |74| `show_risk` | `0` / `1` | `1` | Show the privacy risk panel |75| `show_tips` | `0` / `1` | `1` | Show hover tooltips |76| `show_pii_highlights` | `0` / `1` | `1` | Highlight identifying details |77| `show_rag_highlights` | `0` / `1` | `1` | Highlight matches against external data |78| `show_settings` | `0` / `1` | `0` | Show the live settings panel |79| `show_dp` | `0`โ€“`3` | `1` | When to show the privacy settings panel: never, after each turn, at the start only, or when the conversation ends |80| `show_infr_attr_card` | `0`โ€“`2` | `1` | When to show the inferred-attributes card: never, after each turn, or when the conversation ends |81| `enable_social_scraping` | `0` / `1` | `0` | Retrieve public social media posts as external data (experimental) |82| `show_social_scraping` | `0` / `1` | `0` | Show the social media control in the interface |83| `show_upload_data` | `0` / `1` | `0` | Show the control for uploading a custom corpus |84| `scenario_mode` | `real`, `persona1`, `persona2` | `real` | Free-style conversation, or a scripted persona |85| `demo` | `0` / `1` | `0` | Run the interface without making API calls |86 87`token` is accepted as a URL parameter only, and carries the session access token.88`--retriever_path` (an alternative retriever pickle) and `--port` (default `7860`) are89command-line flags only.90 91## License92 93CC BY 4.0.94