-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
381 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions
117
Code/code/ML/SON/pipeline/frontend/css/wirtingInputarea.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
*, | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
} | ||
|
||
.contentbox { | ||
width: 390px; | ||
margin: auto; | ||
height: 100%; | ||
|
||
} | ||
|
||
@font-face { | ||
font-family: 'Pretendard-Regular'; | ||
src: url('https://fastly.jsdelivr.net/gh/Project-Noonnu/[email protected]/Pretendard-Regular.woff') format('woff'); | ||
font-weight: 400; | ||
font-style: normal; | ||
} | ||
|
||
section.tags { | ||
width: 88%; | ||
display: flex; | ||
justify-content: start; | ||
align-items: center; | ||
margin: auto; | ||
|
||
|
||
} | ||
|
||
button.tag { | ||
margin: 4px; | ||
width: 76px; | ||
height: 30px; | ||
flex-shrink: 0; | ||
border-radius: 43px; | ||
border: 1.5px solid #F29272; | ||
color: #F29272; | ||
cursor: pointer; | ||
background-color: #fff; | ||
font-family: 'Pretendard-Regular'; | ||
font-size: 14px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: normal; | ||
} | ||
|
||
button.tag-add { | ||
width: 30px; | ||
height: 30px; | ||
background-image: url(../icon/plusicon.svg); | ||
background-size: cover; | ||
border: none; | ||
background-color: #fff; | ||
} | ||
|
||
#notchs { | ||
margin: 4px; | ||
width: 76px; | ||
height: 30px; | ||
flex-shrink: 0; | ||
border-radius: 43px; | ||
border: 1.5px solid #ADAAAA; | ||
color: #ADAAAA; | ||
cursor: pointer; | ||
background-color: #fff; | ||
font-family: 'Pretendard-Regular'; | ||
font-size: 14px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: normal; | ||
} | ||
|
||
.container { | ||
width: 390px; /* 고정 너비 설정 */ | ||
margin: 0 auto; | ||
background-color: white; | ||
padding: 20px; | ||
border-radius: 10px; | ||
} | ||
|
||
.color-picker { | ||
display: flex; | ||
justify-content: space-between; | ||
margin-bottom: 15px; | ||
} | ||
|
||
.color-button { | ||
width: 40px; | ||
height: 40px; | ||
border: none; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
} | ||
|
||
.input-field, .textarea { | ||
width: 100%; /* 부모 요소의 너비에 딱 맞게 설정 */ | ||
padding: 10px; | ||
margin-bottom: 15px; | ||
border: 1px solid #ccc; | ||
border-radius: 5px; | ||
} | ||
|
||
.textarea { | ||
height: 100px; /* 높이 설정 */ | ||
} | ||
|
||
.save-button { | ||
width: 100%; | ||
padding: 10px; | ||
background-color: #F29272; | ||
color: white; | ||
border: none; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
} |
10 changes: 10 additions & 0 deletions
10
Code/code/ML/SON/pipeline/frontend/icon/leading-iconnewrecord.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
Code/code/ML/SON/pipeline/frontend/icon/trailing-iconnewrecord.svg
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
<!--css--> | ||
<link rel="stylesheet" href="./css/setup.css"> | ||
<link rel="stylesheet" href="./css/headersubpage.css"> | ||
<link rel="stylesheet" href="./css/wirtingInputarea.css"> | ||
<link rel="stylesheet" href="./css/writingcard.css"> | ||
<!--js--> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" /> | ||
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script> | ||
<script src="./js/wirtingswiper.js" defer></script> | ||
</head> | ||
|
||
<body> | ||
<div class="contentbox"> | ||
<header> | ||
<div class="headerbox"> | ||
<div class="icon"> | ||
<a href="/"><img src="./icon/leading-iconnewrecord.svg" alt="Icon"></a> | ||
</div> | ||
<div class="header-text"> | ||
<p>새로운 기록</p> | ||
</div> | ||
<div class="icon"> | ||
<a href="/"><img src="./icon/trailing-iconnewrecord.svg" alt="Icon"></a> | ||
</div> | ||
</div> | ||
</header> | ||
<div class="topgap"></div> | ||
<div class="swiper"> | ||
<div class="swiper-container"> | ||
<div class="swiper-wrapper"> | ||
<div class="swiper-slide"> | ||
<div class="swipercontent"> | ||
</div> | ||
</div> | ||
<div class="swiper-slide"> | ||
<div class="swipercontent"></div> | ||
</div> | ||
<div class="swiper-slide"> | ||
<div class="swipercontent"> | ||
<div class="imgupload"> | ||
<label for="photo-upload" class="photo-label"> | ||
<input type="file" id="photo-upload" accept="image/*"> | ||
</label> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="swiper-pagination"></div> | ||
|
||
</div> | ||
<section class="tags"> | ||
<button class="tag"># 즐거움</button> | ||
<button class="tag" id="notchs"># 아쉬움</button> | ||
<button class="tag"># 편안함</button> | ||
<button class="tag-add"><i class="fa fa-plus"></i></button> | ||
</section> | ||
|
||
<div class="container"> | ||
<input type="text" placeholder="날짜" class="input-field"> | ||
<input type="text" placeholder="위치" class="input-field"> | ||
<input type="text" placeholder="작성자" class="input-field"> | ||
<textarea placeholder="내용을 입력하세요..." class="textarea"></textarea> | ||
<button class="save-button">저장하기</button> | ||
</div> | ||
<script src="script.js"></script> | ||
</body> | ||
</div> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
var mySwiper = new Swiper ('.swiper-container', { | ||
speed: 400, | ||
spaceBetween: 30, | ||
initialSlide: 0, | ||
//truewrapper adoptsheight of active slide | ||
autoHeight: false, | ||
// Optional parameters | ||
direction: 'horizontal', | ||
loop: true, | ||
// delay between transitions in ms | ||
autoplay: 5000, | ||
autoplayStopOnLast: false, // loop false also | ||
// If we need pagination | ||
pagination: '.swiper-pagination', | ||
paginationType: "bullets", | ||
|
||
// Navigation arrows | ||
nextButton: '.swiper-button-next', | ||
prevButton: '.swiper-button-prev', | ||
|
||
// And if we need scrollbar | ||
//scrollbar: '.swiper-scrollbar', | ||
// "slide", "fade", "cube", "coverflow" or "flip" | ||
effect: 'slide', | ||
// Distance between slides in px. | ||
spaceBetween: 30, | ||
// | ||
slidesPerView: 3, | ||
// | ||
centeredSlides: true, | ||
// | ||
slidesOffsetBefore: 0, | ||
// | ||
grabCursor: true, | ||
}) | ||
|
Binary file added
BIN
+1 MB
Code/code/ML/SON/pipeline/gifs/a promotional video for tourism__식당__33.gif
Oops, something went wrong.
Binary file added
BIN
+1 MB
Code/code/ML/SON/pipeline/gifs/a promotional video for tourism__오월드__97.gif
Oops, something went wrong.
Binary file added
BIN
+1 MB
Code/code/ML/SON/pipeline/gifs/a promotional video for tourism__오월드__97.mp4
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from transformers import AutoModelForCausalLM, AutoTokenizer | ||
import torch | ||
|
||
|
||
|
||
repo = "davidkim205/iris-7b" | ||
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.bfloat16, device_map='auto') | ||
tokenizer = AutoTokenizer.from_pretrained(repo) | ||
|
||
def generate(prompt): | ||
encoding = tokenizer( | ||
prompt, | ||
return_tensors='pt', | ||
return_token_type_ids=False | ||
).to("cuda") | ||
gen_tokens = model.generate( | ||
**encoding, | ||
max_new_tokens=2048, | ||
temperature=1.0, | ||
num_beams=5, | ||
) | ||
prompt_end_size = encoding.input_ids.shape[1] | ||
result = tokenizer.decode(gen_tokens[0, prompt_end_size:]) | ||
|
||
return result | ||
|
||
|
||
def translate_ko2en(text): | ||
prompt = f"[INST] 다음 문장을 영어로 번역하세요.{text} [/INST]" | ||
return generate(prompt) | ||
|
||
|
||
def translate_en2ko(text): | ||
prompt = f"[INST] 다음 문장을 한글로 번역하세요.{text} [/INST]" | ||
return generate(prompt) | ||
|
||
|
||
def main(): | ||
while True: | ||
text = input('>') | ||
en_text = translate_ko2en(text) | ||
ko_text = translate_en2ko(en_text) | ||
print('en_text', en_text) | ||
print('ko_text', ko_text) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import torch | ||
from diffusers import I2VGenXLPipeline | ||
from diffusers.utils import export_to_gif, load_image | ||
from .trans import translate_ko2en | ||
import langdetect | ||
import random | ||
from PIL import Image | ||
import os | ||
|
||
|
||
pipeline = I2VGenXLPipeline.from_pretrained("ali-vilab/i2vgen-xl", torch_dtype=torch.float16, variant="fp16") | ||
pipeline.enable_model_cpu_offload() | ||
generator = torch.manual_seed(0) | ||
|
||
|
||
def vid_generate(recommended_img:str,user_prompt:str,steps,scale,user): | ||
#recommend img is path | ||
path = recommended_img | ||
print(path) | ||
random_number = int(random.random()*100) | ||
prompt = user_prompt | ||
orig_size = Image.open(recommended_img).size | ||
|
||
if orig_size[1]<orig_size[0]: | ||
orig_size2=(orig_size[1],orig_size[0]) | ||
image = load_image(path).convert("RGB") | ||
image=image.resize(orig_size2) | ||
else: | ||
image = load_image(path).convert("RGB") | ||
|
||
if langdetect.detect(prompt)=="ko": | ||
|
||
prompt=translate_ko2en(prompt) | ||
prompt=prompt.split(".")[0] | ||
prompt=prompt.lower() | ||
|
||
|
||
else: | ||
|
||
prompt=prompt.lower() | ||
|
||
|
||
negative_prompt = """Distorted, gray, discontinuous, Ugly, | ||
blurry, low resolution, motionless, | ||
static, disfigured, disconnected limbs, | ||
Ugly faces, incomplete arms""" | ||
|
||
frames = pipeline( | ||
prompt = prompt, | ||
image = image, | ||
num_inference_steps=steps, #95 | ||
negative_prompt=negative_prompt, | ||
guidance_scale=scale, | ||
# 9.0 , 1.0 | ||
generator=generator | ||
).frames[0] | ||
|
||
|
||
name=path.split(".")[0] | ||
if name.find("/")>-1: | ||
name=name.split("/")[-2] | ||
|
||
|
||
os.makedirs(f"{user}/gifs",exist_ok=True) | ||
export_to_gif(frames, f"{user}/gifs/{prompt}__{name}__{random_number}.gif") | ||
print("Gif Saved") | ||
|
||
return f"{user}/gifs/{prompt}__{name}__{random_number}.gif" |
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.