pangkaicheng commited on
Commit
1a4531a
·
1 Parent(s): c4abf56

update readme

Browse files
Files changed (2) hide show
  1. README.md +69 -6
  2. mcp_servers/fashion_vlm/main.py +3 -1
README.md CHANGED
@@ -1,13 +1,76 @@
1
- FashionRec Dataset download is required
2
 
3
- .env file is required, including
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  CHAINLIT_PORT=8888
6
 
 
7
  PROXY=http://127.0.0.1:10809
8
 
9
- OPENAI_API_KEY=
10
- GEMINI_API_KEY=
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
- FASHION_DATA_ROOT=path_to_FashionRec
13
- GEN_IMG_DIR="./generated_images"
 
1
+ # FashionM3 Project Setup Guide
2
 
3
+ This guide explains how to set up and run the FashionM3 project, which requires the FashionRec dataset, environment configuration, and specific server startup steps.
4
 
5
+ ## Prerequisites
6
+
7
+ - Python 3.10 or higher
8
+ - `pip` for installing dependencies
9
+ - A working proxy server (if needed, e.g., at `http://127.0.0.1:10809`)
10
+
11
+ ## Step 1: Download the FashionRec Dataset
12
+
13
+ 1. Download the FashionRec dataset from https://huggingface.co/datasets/Anony100/FashionRec
14
+ 2. Extract the dataset to a directory of your choice (e.g., `/path/to/FashionRec`).
15
+ 3. Note the absolute path to the dataset directory, as it will be used in the `.env` file.
16
+
17
+ ## Step 2: Configure the Environment File
18
+
19
+ Create a `.env` file in the project root directory with the following content:
20
+
21
+ ```plaintext
22
+ # Chainlit server port
23
  CHAINLIT_PORT=8888
24
 
25
+ # Proxy configuration (update or remove if not needed)
26
  PROXY=http://127.0.0.1:10809
27
 
28
+ # API keys (replace with your own keys)
29
+ OPENAI_API_KEY=your_openai_api_key_here
30
+ GEMINI_API_KEY=your_gemini_api_key_here
31
+
32
+ # Path to the FashionRec dataset (update to your dataset path)
33
+ FASHION_DATA_ROOT=/path/to/FashionRec
34
+
35
+ # Directory for generated images
36
+ GEN_IMG_DIR=./generated_images
37
+ ```
38
+
39
+ ### Notes:
40
+ - Replace `your_openai_api_key_here` and `your_gemini_api_key_here` with your actual OpenAI and Google Gemini API keys.
41
+ - Set FASHION_DATA_ROOT to the absolute path of the FashionRec dataset (e.g., /home/user/data/FashionRec).
42
+ - Update PROXY to match your proxy server, or remove it if no proxy is used.
43
+
44
+ ## Step 3: Install Dependencies
45
+
46
+ Install the required Python packages:
47
+ ```bash
48
+ pip install -r requirements.txt
49
+ ```
50
+
51
+ ## Step 4: Run the Application
52
+ Follow these steps to start the FashionM3 application:
53
+ ### 1. Start the Fashion VLM MCP Server:
54
+ Run the MCP server for the fashion vision-language model:
55
+ ```bash
56
+ python mcp_servers/fashion_vlm/main.py
57
+ ```
58
+
59
+ Ensure the server starts successfully and remains running.
60
+
61
+ ### 2. Start the FashionM3 Client:
62
+ Launch the Chainlit client to interact with the Fashion Assistant:
63
+ ```bash
64
+ chainlit run chainlit_app.py --port 8888
65
+ ```
66
+
67
+ ### 3. Interact with the Fashion Assistant:
68
+ Open your browser and navigate to:
69
+ ```plaintext
70
+ http://localhost:8888/
71
+ ```
72
+
73
+ This will load the FashionM3 interface, allowing you to interact with the Fashion Assistant.
74
+
75
+
76
 
 
 
mcp_servers/fashion_vlm/main.py CHANGED
@@ -28,6 +28,8 @@ load_dotenv()
28
  FASHION_DATA_ROOT = os.getenv("FASHION_DATA_ROOT", "/mnt/d/PostDoc/fifth paper/code/FashionVLM/datasets/FashionRec")
29
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
30
  OPENAI_API_BASE = os.getenv("OPENAI_API_BASE")
 
 
31
  openai = AsyncOpenAI(api_key=OPENAI_API_KEY, base_url=OPENAI_API_BASE)
32
  VALID_CATEGORIES = [
33
  'Pants', 'Coats', 'Cross-body bags', 'Shirts', 'Hats & caps', 'Sneakers', 'Jeans', 'Boots', 'Dresses', 'Sandals',
@@ -64,7 +66,7 @@ fashion_vlm = FashionVLM(
64
  temperature=0.8,
65
  top_k=1,
66
  fashion_vlm_name='Anony100/FashionVLM',
67
- save_dir="/mnt/d/PostDoc/fifth paper/code/FashionM3/generated_images"
68
  )
69
 
70
  resolution = 512
 
28
  FASHION_DATA_ROOT = os.getenv("FASHION_DATA_ROOT", "/mnt/d/PostDoc/fifth paper/code/FashionVLM/datasets/FashionRec")
29
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
30
  OPENAI_API_BASE = os.getenv("OPENAI_API_BASE")
31
+ GEN_IMG_DIR = os.getenv("GEN_IMG_DIR")
32
+ os.makedirs(GEN_IMG_DIR, exist_ok=True)
33
  openai = AsyncOpenAI(api_key=OPENAI_API_KEY, base_url=OPENAI_API_BASE)
34
  VALID_CATEGORIES = [
35
  'Pants', 'Coats', 'Cross-body bags', 'Shirts', 'Hats & caps', 'Sneakers', 'Jeans', 'Boots', 'Dresses', 'Sandals',
 
66
  temperature=0.8,
67
  top_k=1,
68
  fashion_vlm_name='Anony100/FashionVLM',
69
+ save_dir=GEN_IMG_DIR
70
  )
71
 
72
  resolution = 512